Process crash due to shared file access exceptions
See original GitHub issueI’m running a simple scenario where I add a bunch of items to a queue and having a trivial C# function process the messages. I’m only ever running on a single VM. Periodically, it seems the host process crashes, and I see the following in my eventlog.xml:
An unhandled exception occurred and the process was terminated.
Application ID: /LM/W3SVC/1961040831/ROOT
Process ID: 3472
Exception: System.IO.IOException
Message: The process cannot access the file ‘D:\home\LogFiles\Application\Functions\Host\bd51ad17-edf1-4601-9cd8-dba2800743e4-6dd04c4de4.log’ because it is being used by another process.
StackTrace: at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) 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) at System.IO.FileStream…ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost) at System.IO.StreamWriter.CreateFile(String path, Boolean append, Boolean checkHost) at System.IO.StreamWriter…ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize, Boolean checkHost) at System.IO.StreamWriter…ctor(String path, Boolean append, Encoding encoding) at System.IO.File.InternalAppendAllText(String path, String contents, Encoding encoding) at System.IO.File.AppendAllText(String path, String contents) at Microsoft.Azure.WebJobs.Script.FileTraceWriter.AppendLine(String line) at Microsoft.Azure.WebJobs.Script.FileTraceWriter.Trace(TraceEvent traceEvent) at Microsoft.Azure.WebJobs.Host.CompositeTraceWriter.InvokeTraceWriters(TraceEvent traceEvent) at Microsoft.Azure.WebJobs.Host.CompositeTraceWriter.Trace(TraceEvent traceEvent) at Microsoft.Azure.WebJobs.Host.Loggers.TraceWriterFunctionInstanceLogger.LogFunctionCompletedAsync(FunctionCompletedMessage message, CancellationToken cancellationToken) at Microsoft.Azure.WebJobs.Host.Loggers.CompositeFunctionInstanceLogger.<LogFunctionCompletedAsync>d__8.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.<TryExecuteAsync>d__1.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Azure.WebJobs.Host.Executors.TriggeredFunctionExecutor`1.<TryExecuteAsync>d__0.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Azure.WebJobs.Host.Queues.Listeners.QueueTriggerExecutor.<ExecuteAsync>d__1.MoveNext() — End of stack trace from previous location where exception was thrown — at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task) at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task) at Microsoft.Azure.WebJobs.Host.Queues.Listeners.QueueListener.<ProcessMessageAsync>d__11.MoveNext() — End of stack trace from previous location where exception was thrown — at Microsoft.Azure.WebJobs.Host.Timers.BackgroundExceptionDispatcher.<>c__DisplayClass1.<Throw>b__0() at System.Threading.ThreadHelper.ThreadStart_Context(Object state) at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) at System.Threading.ThreadHelper.ThreadStart()
Seems like a recent regression since I didn’t have this problem last week.
Issue Analytics
- State:
- Created 7 years ago
- Comments:5 (5 by maintainers)
Top GitHub Comments
Looks like I actually was using a private site extension. There was a D:\home\SiteExtensions\Functions directory in my app and those were the bits being loaded. I stopped the site, deleted that directory, started the site again, and now I’m using the latest bits. Not exactly sure how that happened, but for now I’m going to assume this is not a real product issue.
No, I’m pretty sure I’m not using a private SiteExtension (I’m not even sure how to set that up), but it does appear that I’m somehow on an old build. Is there an assembly version or something I can look at to confirm? This is a private Antares deployment, so I don’t know whether it affects public Azure, but my understanding is that all environments get the same bits.