You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A user on Azure Functions doing a high throughput event hubs scenario reported they often see an exception with the following trace:
System.ArgumentOutOfRangeException: Index and count must refer to a location within the buffer. Parameter name: chars at
System.Text.EncoderNLS.GetBytes(Char[] chars, Int32 charIndex, Int32
charCount, Byte[] bytes, Int32 byteIndex, Boolean flush) at
System.IO.StreamWriter.Flush(Boolean flushStream, Boolean flushEncoder) at
System.IO.StreamWriter.Flush() at
Microsoft.Azure.WebJobs.Host.CompositeTraceWriter.Flush() at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.<ExecuteWithLoggingAsync>d__14.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 System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task
task) at Microsoft.Azure.WebJobs.Host.Executors.FunctionExecutor.<TryExecuteAsync>d__12.MoveNext()
From the trace it looks likely that the problem is unsynchronized access to a StreamWriter. Considering that FileTraceWriter has the only non-trivial implementation of TraceWriter.Flush, its the most likely source of the issue.
The text was updated successfully, but these errors were encountered:
It may come from FileTraceWriter, but it's not entirely clear:
I do see that this also has StringBuilder in the Flush path, but it's not in the stack for the error, which I would expect if it was the same bug. You also get a new StringBuilder with every call to Flush, unlike the above issues.
FileTraceWriter locks around its writing -- which is a call to File.AppendAllText. I wouldn't expect to see this come from that code.
A user on Azure Functions doing a high throughput event hubs scenario reported they often see an exception with the following trace:
(original report here)
From the trace it looks likely that the problem is unsynchronized access to a StreamWriter. Considering that FileTraceWriter has the only non-trivial implementation of TraceWriter.Flush, its the most likely source of the issue.
The text was updated successfully, but these errors were encountered: