So – one of my teammates tells me that if he leaves MFCMAPI running overnight, it has usually crashed by the time he comes in the next morning. We got a few dumps, but they were inconclusive since the stacks were completely different every time. Since we didn’t know what was going on, we started paying attention to when and where the problem happened. We noted the following:
- He usually runs MFCMAPI from a tools share on one of my machines.
- If he copies MFCMAPI locally and runs it overnight, it never crashes.
- If he tries running some other tools from the same share, he can cause them to crash overnight as well.
- Another engineer who overheard us discussing the problem was also able to reproduce it.
Armed with this information, I decided to look at the dumps again. The exception thrown in each was 0xC0000006, STATUS_IN_PAGE_ERROR. Ok – so that’s explains things – maybe some network hiccup causes us to lose the connection to the original executable, then the next time the process needs to load a page of memory it can’t find it?
For a while, I thought this was the end of the investigation – there’s no way MFCMAPI can control network hiccups, right? Then I stumbled across this linker option:
Basically, when this option is set, the OS will copy the whole binary image to a local swap file before running it. We set the “Swap Run From Network” switch on a test build, and he hasn’t been able to reproduce the crash again. If you’re in to manually editing your .vcproj file, this is the equivalent of adding the line
to the “VCLinkerTool” section of your project’s configuration.
The next version of MFCMAPI will have this option enabled for all configurations.