DVB Guide issues - "cannot schedule recoding because guide data cannot be accessed"

We have been getting reports about Guide problems from DVB users across Europe and the world, hopefully in time for the next Rollup release (external date not yet announced, but should be late Q1 to early Q2).  The problem typically manifests itself when scheduling many shows to record, but can occur anytime.  Without a code fix, you cannot work around the issue cleanly/easily, but closing the shell (Media Center UI) and restarting the "Media Center Scheduler Service" (ehsched) will reset the state of the machine.

Edit: This is the "cannot schedule recording because guide data can't be accessed" issue.

We root-caused the problem to an unusual memory management problem in how we deal with the Guide data.  For performance reasons, we temporarily increase certain buffer sizes during a Guide download, and decrease them again later.  There is a timing issue with garbage collection events in some situations, though, that can cause the decrease to not take effect "in time", thus keeping the buffer sizes large.  This does not actually reduce the amount of real memory used, but it does exhaust the virtual address space eventually.  You can observe the behavior using SysInternals' Process Explorer by adding the "Virtual Size" column (under the Process Performance tab) and observing its value for ehrec.exe.

With better knowledge of the cause, though, comes a better workaround than "gun ehshell.exe and restart ehsched when it happens".  Until the fix comes out, the best thing to do to prevent this problem from occurring is probably to set up a Scheduled Task to do those things for you at a predictable time. To wit:

  1. Download recycle_mce.cmd from here. (script to recycle ehshell.exe and TV services).  Unpack the script somewhere on your drive.
  2. Change your Guide download time to a time that you are not likely to have a need to either watch TV on your MCE or record a show.  4am is pretty safe for me, but to each his own.  I wrote a tool that lets you edit this time easily, you can download it from my site.
  3. Create a Scheduled Task to run the script daily about 30 minutes after the time you configured the Guide to download.  If you have a modem, you may need to give it more time.  If you have a pretty fast computer and broadband, 30 minutes is very generous. Guide to creating scheduled tasks.

It's not a perfect solution, since a) it presumes you have a time during the day you will not make recordings or watch TV, and b) it cannot prevent the problem 100%, especially if you are a "heavy" user.  If you run into the problem, though, running recycle_mce.cmd will at least reset your state.

The real fix is coming with the next rollup, but since there are users out there feeling pain now, I thought I'd try to help a little.

The programs, scripts, and instructions in this posting are provided AS-IS, with no warranties, and are not sanctioned nor released by Microsoft.