question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Process crash due to shared file access exceptions

See original GitHub issue

I’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:closed
  • Created 7 years ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
cgillumcommented, Apr 12, 2016

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.

0reactions
cgillumcommented, Apr 12, 2016

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Avoid crashing when file is locked?
Running standalone it crashes "Application stop running" and last error message I get prior the crash on the error log file is related...
Read more >
Project Crash using shared resource file
I have two project files, one with 20 resources and no tasks - the other with two tasks and using the shared resources...
Read more >
Exception Access Violation: What It Is and How to Fix It on ...
This can be caused by an outdated program version, corrupted files, incompatible hardware and software, or a virus or malware infection. Common ...
Read more >
Do exceptions basically exist to prevent a system from ...
Exceptions exist to allow Exception Handling, which can avoid crashes but more generally prevent unwanted or unpredictable system behavior.
Read more >
Understanding the exception types in a crash report
The crash is due to a memory access issue. See Investigating memory access crashes. EXC_CRASH (SIGABRT). The process terminated because it received a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found