Try our conversational search powered by Generative AI!

Locking on file EPiFX7-AssemblyScan_log4net.xml

Vote:
 

Hi, 

When restarting our Episerver web applications we frequently get a file locking problem on a file named EPiFX7-AssemblyScan_log4net.xml, full info below. The file locking persists for about 20 sec, then the app restarts ok.

This is annoying during local development but easy to resolve by waiting a short time. On our staging server however users simply see that the site is broken.

Is there an easy fix?

 

thanks,

Andy

 

Server Error in '/' Application.

The process cannot access the file 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\9e36c06e\29c2374f\UserCache\EPiFX7-AssemblyScan_log4net.xml' because it is being used by another process.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.IO.IOException: The process cannot access the file 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\9e36c06e\29c2374f\UserCache\EPiFX7-AssemblyScan_log4net.xml' because it is being used by another process.

Source Error:


[No relevant source lines]

Source File: c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\9e36c06e\29c2374f\App_global.asax.4oxltbgc.0.cs Line: 0

Stack Trace:


[IOException: The process cannot access the file 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\9e36c06e\29c2374f\UserCache\EPiFX7-AssemblyScan_log4net.xml' because it is being used by another process.]
EPiServer.Framework.Initialization.InitializationEngine.SetupAssemblyTypeScanner() +947
EPiServer.Framework.Initialization.InitializationEngine.ScanAssemblies() +18
EPiServer.Framework.Initialization.InitializationModule.Initialize(HostType hostType) +262
EPiServer.Framework.Initialization.InitializationModule.FrameworkInitialization(HostType hostType) +104
EPiServer.Global..ctor() +110
Platinum.Web.Global..ctor() +40
ASP.global_asax..ctor() in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\9e36c06e\29c2374f\App_global.asax.4oxltbgc.0.cs:0

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean noCheck, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& bNeedSecurityCheck) +0
System.RuntimeType.CreateInstanceSlow(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +159
System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, StackCrawlMark& stackMark) +256
System.Activator.CreateInstance(Type type, Boolean nonPublic) +127
System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark) +14426381
System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes) +200
System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture) +28
System.Web.HttpRuntime.CreateNonPublicInstance(Type type, Object[] args) +83
System.Web.HttpApplicationFactory.GetSpecialApplicationInstance(IntPtr appContext, HttpContext context) +312
System.Web.Hosting.PipelineRuntime.InitializeApplication(IntPtr appContext) +475

[HttpException (0x80004005): Exception has been thrown by the target of an invocation.]
System.Web.HttpRuntime.FirstRequestInit(HttpContext context) +12880068
System.Web.HttpRuntime.EnsureFirstRequestInit(HttpContext context) +159
System.Web.HttpRuntime.ProcessRequestNotificationPrivate(IIS7WorkerRequest wr, HttpContext context) +12721257

#66396
Feb 28, 2013 0:57
Vote:
 

I've never seen this error before, I would start to clear Tempoary ASP.NET Files to make sure there is not any currupt files in there (remove everything in c:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files).

Then turn on debug logging and post all log events from CachingAssemblyScanner when the error happens. Should look something like:

[7112] [1] DEBUG EPiServer.Framework.TypeScanner.CachingAssemblyScanner: Reading cached types for Castle.Windsor

..then you should get a "Type lookup failed" message from InitializationEngine, post that as well.

#66400
Feb 28, 2013 8:52
Vote:
 

Looks promising. Since clearing the temp files I haven't had the locking error. Weird, as we were getting the error on 4 different installations so can't have just been some local machine corruption that caused it. I'll update this post with the extra logging if it comes back.

thanks,

Andy

#66507
Mar 03, 2013 23:44
Vote:
 

Hi,

The error has come back today. The only instance of CachingAssemblyScanner anywhere in the debug log is:

[9260] [97] DEBUG EPiServer.Framework.TypeScanner.CachingAssemblyScanner: Updating cache for EPiServer.Scheduler.WKTL 

    

Clearing the ASP.NET Temporary files before attempting to restart the web app does seem to make the error go away for a while. Not sure what the sequence of steps is that causes the locking to return.

 

The trace of all the Type lookup failure items follows. Looks like it's just reporting the file is locked, not any additional information as to why.

thanks,

Andy

 

[9260] [134] ERROR EPiServer.Framework.Initialization.InitializationEngine: Type lookup failed 
[9260] System.AggregateException: One or more errors occurred. ---> System.IO.IOException: The process cannot access the file 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\9e36c06e\29c2374f\UserCache\EPiFX7-AssemblyScan_log4net.xml' because it is being used by another process. 
[9260]    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) 
[9260]    at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) 
[9260]    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy) 
[9260]    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize) 
[9260]    at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn) 
[9260]    at System.Xml.XmlTextReaderImpl.FinishInitUriString() 
[9260]    at System.Xml.XmlReaderSettings.CreateReader(String inputUri, XmlParserContext inputContext) 
[9260]    at System.Xml.Linq.XElement.Load(String uri, LoadOptions options) 
[9260]    at EPiServer.Framework.TypeScanner.CachingAssemblyScanner.LoadCache(Assembly assembly) 
[9260]    at EPiServer.Framework.TypeScanner.CachingAssemblyScanner.GetTypes(Assembly assembly) 
[9260]    at EPiServer.Framework.Initialization.InitializationEngine.<>c__DisplayClassa.<SetupAssemblyTypeScanner>b__8(Assembly assembly) 
[9260]    at System.Threading.Tasks.Parallel.<>c__DisplayClassf`1.<ForWorker>b__c() 
[9260]    at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask) 
[9260]    at System.Threading.Tasks.Task.<>c__DisplayClass10.<ExecuteSelfReplicating>b__f(Object param0) 
[9260]    --- End of inner exception stack trace --- 
[9260]    at System.Threading.Tasks.Task.Wait(Int32 millisecondsTimeout, CancellationToken cancellationToken) 
[9260]    at System.Threading.Tasks.Task.Wait() 
[9260]    at System.Threading.Tasks.Parallel.ForWorker[TLocal](Int32 fromInclusive, Int32 toExclusive, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Func`4 bodyWithLocal, Func`1 localInit, Action`1 localFinally) 
[9260]    at System.Threading.Tasks.Parallel.ForEachWorker[TSource,TLocal](IEnumerable`1 source, ParallelOptions parallelOptions, Action`1 body, Action`2 bodyWithState, Action`3 bodyWithStateAndIndex, Func`4 bodyWithStateAndLocal, Func`5 bodyWithEverything, Func`1 localInit, Action`1 localFinally) 
[9260]    at System.Threading.Tasks.Parallel.ForEach[TSource](IEnumerable`1 source, Action`1 body) 
[9260]    at EPiServer.Framework.Initialization.InitializationEngine.SetupAssemblyTypeScanner() 
[9260] ---> (Inner Exception #0) System.IO.IOException: The process cannot access the file 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\9e36c06e\29c2374f\UserCache\EPiFX7-AssemblyScan_log4net.xml' because it is being used by another process. 
[9260]    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) 
[9260]    at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) 
[9260]    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy) 
[9260]    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize) 
[9260]    at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn) 
[9260]    at System.Xml.XmlTextReaderImpl.FinishInitUriString() 
[9260]    at System.Xml.XmlReaderSettings.CreateReader(String inputUri, XmlParserContext inputContext) 
[9260]    at System.Xml.Linq.XElement.Load(String uri, LoadOptions options) 
[9260]    at EPiServer.Framework.TypeScanner.CachingAss
[9260] emblyScanner.LoadCache(Assembly assembly) 
[9260]    at EPiServer.Framework.TypeScanner.CachingAssemblyScanner.GetTypes(Assembly assembly) 
[9260]    at EPiServer.Framework.Initialization.InitializationEngine.<>c__DisplayClassa.<SetupAssemblyTypeScanner>b__8(Assembly assembly) 
[9260]    at System.Threading.Tasks.Parallel.<>c__DisplayClassf`1.<ForWorker>b__c() 
[9260]    at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask) 
[9260]    at System.Threading.Tasks.Task.<>c__DisplayClass10.<ExecuteSelfReplicating>b__f(Object param0)<--- 
[9260]  
[9260] [134] ERROR EPiServer.Framework.Initialization.InitializationEngine: Type lookup failed 
[9260] System.IO.IOException: The process cannot access the file 'C:\Windows\Microsoft.NET\Framework64\v4.0.30319\Temporary ASP.NET Files\root\9e36c06e\29c2374f\UserCache\EPiFX7-AssemblyScan_log4net.xml' because it is being used by another process. 
[9260]    at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) 
[9260]    at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) 
[9260]    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy) 
[9260]    at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize) 
[9260]    at System.Xml.XmlUrlResolver.GetEntity(Uri absoluteUri, String role, Type ofObjectToReturn) 
[9260]    at System.Xml.XmlTextReaderImpl.FinishInitUriString() 
[9260]    at System.Xml.XmlReaderSettings.CreateReader(String inputUri, XmlParserContext inputContext) 
[9260]    at System.Xml.Linq.XElement.Load(String uri, LoadOptions options) 
[9260]    at EPiServer.Framework.TypeScanner.CachingAssemblyScanner.LoadCache(Assembly assembly) 
[9260]    at EPiServer.Framework.TypeScanner.CachingAssemblyScanner.GetTypes(Assembly assembly) 
[9260]    at EPiServer.Framework.Initialization.InitializationEngine.<>c__DisplayClassa.<SetupAssemblyTypeScanner>b__8(Assembly assembly) 
[9260]    at System.Threading.Tasks.Parallel.<>c__DisplayClassf`1.<ForWorker>b__c() 
[9260]    at System.Threading.Tasks.Task.InnerInvokeWithArg(Task childTask) 
[9260]    at System.Threading.Tasks.Task.<>c__DisplayClass10.<ExecuteSelfReplicating>b__f(Object param0) 
[3428] FMAPO: DllCanUnloadNow 
[976] <976,9256,10:55:34:937>: 
[976] +SpAcquireCredentialsHandle(fCredentials=0x2)@credapi.cxx_70
[976] 
[976] <976,9256,10:55:34:937>: 
[976] -SpAcquireCredentialsHandle=0x0
[976] 

    

#66557
Mar 05, 2013 1:05
Vote:
 

Try to set optimizeCompilations="false" in web.config and see if that solves it, you will get slower startups but it would be interesting to see if it solves the problem.

#66721
Mar 07, 2013 16:12
Vote:
 

I've already got optimizeCompilations="false" in my local instance so that doesn't stop it.

 

Thanks.

#66731
Mar 08, 2013 7:12
Vote:
 

Check which process is locking the file (if its the same process that is trying to access the file which you should be able to see in the log or another process such as anti-virus software or another w3wp process that is having some problems..):

http://serverfault.com/questions/1966/how-do-you-find-what-process-is-holding-a-file-open-in-windows

#66749
Mar 08, 2013 12:51
Vote:
 

Hi! I'm having the exact same problem (sometimes with EPiFX7-AssemblyScan_NuGet.Core.xml instead of EPiFX7-AssemblyScan_log4net.xml). Using the Process Explorer I can't find anything when searching for these two files. Any ideas at all?

#68175
Mar 18, 2013 13:24
Vote:
 

Erik, when you say you have the exact same problem do you also experience that is sticks for 20 seconds or so and then starts up. Does the problem come back again directly or ?

If you take memory dump on a few occurrences of the problem (use adplus -hang whenever you have this error and collect a few) . Then open a support case so we can have a look at the problem.

#68220
Mar 19, 2013 10:34
Vote:
 

I am experiencing this as well. When it sticks I do a full iisrestart and it works again. Annoying!

 

#70096
Apr 11, 2013 17:44
Vote:
 

We will add some error handling on this for Patch 3 to ignore locked files, I have no idea why this is happening but I am guessing it has something to do with ASP.NET locking files to do a full rebuild of the site. Let me know if you find any more clues to the cause.

#70124
Apr 12, 2013 9:44
Vote:
 

Sorry I haven't answerd your question Per! In may case to problem was TEMPORARY solved by adding optimizeCompilations="false". I haven't had the time to look at it more in depth I'm afraid.

#70126
Apr 12, 2013 9:49
This thread is locked and should be used for reference only. Please use the Episerver CMS 7 and earlier versions forum to open new discussions.
* You are NOT allowed to include any hyperlinks in the post because your account hasn't associated to your company. User profile should be updated.