Blog posts by Huy Le2014-03-31T10:35:28.0000000Z/blogs/Huy-Le/Optimizely WorldJob Fails Issue/blogs/Huy-Le/Dates/2014/3/Job-Fails-Issue/2014-03-31T10:35:28.0000000Z<p>Here's a short note on a case we had recently, hopefully it might be useful to somebody.</p> <p>A Partner had an issue with a custom EPiServer scheduled job (commerce import) that failed intermittently on their CMS 7 site, the error message that the job failed with was: "Thread was being aborted."</p> <p>We suspected that the application was going down and after some pondering a colleague suggested adding this very useful tool to the site Bin folder which logs application shutdown events on the machine’s Window log:</p> <p><a href="http://epiwiki.se/tools/application-restart-detector/">http://epiwiki.se/tools/application-restart-detector</a></p> <p>The tool logged the below shutdown event in the Windows logs (Application) on the machine very shortly before the job stopped running.</p> <p>This was logged many times on the server:</p> <p>Application restarted because:MaxRecompilationsReached <br />   at System.Environment.GetStackTrace(Exception e, Boolean needFileInfo) <br />   at System.Environment.get_StackTrace() <br />   at System.Web.Hosting.HostingEnvironment.InitiateShutdownInternal() <br />   at System.Web.HttpRuntime.ShutdownAppDomain(String stackTrace) <br />   at System.Web.Compilation.DiskBuildResultCache.ShutdownCallBack(Object state) <br />   at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) <br />   at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) <br />   at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem() <br />   at System.Threading.ThreadPoolWorkQueue.Dispatch()</p> <p>We were still unsure what lay behind the error so we added another tool made by the same colleague, though this didn't shed any light on the issue this time:</p> <p><a href="http://epiwiki.se/tools/asseblyloaderdetector">http://epiwiki.se/tools/asseblyloaderdetector</a></p> <p>A couple of colleagues mentioned that there was a recent bug report concerning EPiServer.Web.Hosting.VirtualPathMappedProvider</p> <p>,which we saw was being used on the site in question.</p> <p>The ="DynamicContentPreview" VirtualPathMappedProvider was then commented out from the episerverframework config.</p> <p>After this was commented out the MaxRecompilationsReached error stopped the job has not failed since.</p> <p>The cause of this issue is covered by this recently reported bug:</p> <p><a href="Bug #112977: Excessive recompilations causing performance problems">Bug #112977: Excessive recompilations causing performance problems</a></p> <p><a href="http://world.episerver.com/Documentation/Release-Notes/ReleaseNote/?releaseNoteId=112977">http://world.episerver.com/Documentation/Release-Notes/ReleaseNote/?releaseNoteId=112977</a></p> <p>Thanks to all that gave assistance on this case! //Paul & co</p>