Azure / azure-sdk-for-net

This repository is for active development of the Azure SDK for .NET. For consumers of the SDK we recommend visiting our public developer docs at https://learn.microsoft.com/dotnet/azure/ or our versioned developer docs at https://azure.github.io/azure-sdk-for-net.
MIT License
5.25k stars 4.6k forks source link

[BUG] IndexOutOfRangeException in EventSource #23203

Closed kasobol-msft closed 6 months ago

kasobol-msft commented 3 years ago

Describe the bug

System.Diagnostics.Tracing.EventSourceException : An error occurred when writing to a listener.
----> System.IndexOutOfRangeException : Index was outside the bounds of the array.
 at System.Diagnostics.Tracing.EventSource.DispatchToAllListeners(Int32 eventId, Guid* childActivityID, EventWrittenEventArgs eventCallbackArgs)
   at System.Diagnostics.Tracing.EventSource.WriteToAllListeners(Int32 eventId, UInt32* osThreadId, DateTime* timeStamp, Guid* activityID, Guid* childActivityID, Object[] args)
   at System.Diagnostics.Tracing.EventSource.WriteEventVarargs(Int32 eventId, Guid* childActivityID, Object[] args)
   at System.Diagnostics.Tracing.EventSource.WriteEvent(Int32 eventId, Object[] args)
   at Azure.Core.Diagnostics.AzureCoreEventSource.ErrorResponse(String requestId, Int32 status, String reasonPhrase, String headers, Double seconds)
   at Azure.Core.Pipeline.LoggingPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
   at Azure.Core.Pipeline.TaskExtensions.EnsureCompleted(ValueTask task)
   at Azure.Core.Pipeline.LoggingPolicy.Process(HttpMessage message, ReadOnlyMemory`1 pipeline)
   at Azure.Core.Pipeline.HttpPipelinePolicy.ProcessNext(HttpMessage message, ReadOnlyMemory`1 pipeline)
   at Azure.Core.Pipeline.HttpPipelineSynchronousPolicy.Process(HttpMessage message, ReadOnlyMemory`1 pipeline)
   at Azure.Core.Pipeline.HttpPipelinePolicy.ProcessNext(HttpMessage message, ReadOnlyMemory`1 pipeline)
   at Azure.Core.Pipeline.HttpPipelineSynchronousPolicy.Process(HttpMessage message, ReadOnlyMemory`1 pipeline)
   at Azure.Core.Pipeline.HttpPipelinePolicy.ProcessNext(HttpMessage message, ReadOnlyMemory`1 pipeline)
   at Azure.Core.Pipeline.RedirectPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
   at Azure.Core.Pipeline.TaskExtensions.EnsureCompleted(ValueTask task)
   at Azure.Core.Pipeline.RedirectPolicy.Process(HttpMessage message, ReadOnlyMemory`1 pipeline)
   at Azure.Core.Pipeline.HttpPipelinePolicy.ProcessNext(HttpMessage message, ReadOnlyMemory`1 pipeline)
   at Azure.Core.Pipeline.RetryPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
   at Azure.Core.Pipeline.RetryPolicy.ProcessAsync(HttpMessage message, ReadOnlyMemory`1 pipeline, Boolean async)
   at Azure.Core.Pipeline.TaskExtensions.EnsureCompleted(ValueTask task)
   at Azure.Core.Pipeline.RetryPolicy.Process(HttpMessage message, ReadOnlyMemory`1 pipeline)
   at Azure.Core.Pipeline.HttpPipelinePolicy.ProcessNext(HttpMessage message, ReadOnlyMemory`1 pipeline)
   at Azure.Core.Pipeline.HttpPipelineSynchronousPolicy.Process(HttpMessage message, ReadOnlyMemory`1 pipeline)
   at Azure.Core.Pipeline.HttpPipelinePolicy.ProcessNext(HttpMessage message, ReadOnlyMemory`1 pipeline)
   at Azure.Core.Pipeline.HttpPipelineSynchronousPolicy.Process(HttpMessage message, ReadOnlyMemory`1 pipeline)
   at Azure.Core.Pipeline.HttpPipelinePolicy.ProcessNext(HttpMessage message, ReadOnlyMemory`1 pipeline)
   at Azure.Core.Pipeline.HttpPipelineSynchronousPolicy.Process(HttpMessage message, ReadOnlyMemory`1 pipeline)
   at Azure.Core.Pipeline.HttpPipelinePolicy.ProcessNext(HttpMessage message, ReadOnlyMemory`1 pipeline)
   at Azure.Core.Pipeline.HttpPipelineSynchronousPolicy.Process(HttpMessage message, ReadOnlyMemory`1 pipeline)
   at Azure.Core.Pipeline.HttpPipeline.Send(HttpMessage message, CancellationToken cancellationToken)
   at Azure.Storage.Queues.QueueRestClient.Delete(Nullable`1 timeout, CancellationToken cancellationToken) in /_/sdk/storage/Azure.Storage.Queues/src/Generated/QueueRestClient.cs:line 139
   at Azure.Storage.Queues.QueueClient.DeleteInternal(Boolean async, CancellationToken cancellationToken, String operationName) in /_/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs:line 1008
   at Azure.Storage.Queues.QueueClient.DeleteIfExistsInternal(Boolean async, CancellationToken cancellationToken) in /_/sdk/storage/Azure.Storage.Queues/src/QueueClient.cs:line 898
   at Azure.Core.Pipeline.TaskExtensions.EnsureCompleted[T](Task`1 task) in /_/sdk/core/Azure.Core/src/Shared/TaskExtensions.cs:line 33
   at Azure.Storage.Queues.QueueClient.Dele

Expected behavior No exception

Actual behavior (include Exception or Stack Trace) Exception being thrown.

To Reproduce Steps to reproduce the behavior (include a code snippet, screenshot, or any additional information that might help us reproduce the issue)

This seems to be intermittent error that was hit in storage live tests.

Environment: https://dev.azure.com/azure-sdk/internal/_build/results?buildId=1038417&view=ms.vss-test-web.build-test-results-tab&runId=22357766&resultId=105598&paneView=debug

image

christothes commented 2 years ago

Another instance of this:

Failed Catch_Bad_Name_At_IndexTime [63 ms]
Error Message:
 System.Diagnostics.Tracing.EventSourceException : An error occurred when writing to a listener.
----> System.IndexOutOfRangeException : Index was outside the bounds of the array.
Stack Trace:
   at System.Diagnostics.Tracing.EventSource.DispatchToAllListeners(Int32 eventId, Guid* childActivityID, EventWrittenEventArgs eventCallbackArgs)
 at System.Diagnostics.Tracing.EventSource.WriteEventVarargs(Int32 eventId, Guid* childActivityID, Object[] args)
 at Azure.Core.Diagnostics.AzureCoreEventSource.ErrorResponse(String requestId, Int32 status, String reasonPhrase, String headers, Double seconds) in D:\a\_work\1\s\sdk\core\Azure.Core\src\Diagnostics\AzureCoreEventSource.cs:line 98
 at Azure.Core.Pipeline.LoggingPolicy.<ProcessAsync>d__9.MoveNext() in D:\a\_work\1\s\sdk\core\Azure.Core\src\Pipeline\Internal\LoggingPolicy.cs:line 107
--- End of stack trace from previous location where exception was thrown ---
 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
 at Azure.Core.Pipeline.LoggingPolicy.Process(HttpMessage message, ReadOnlyMemory`1 pipeline) in D:\a\_work\1\s\sdk\core\Azure.Core\src\Pipeline\Internal\LoggingPolicy.cs:line 37
 at Azure.Core.Pipeline.HttpPipelinePolicy.ProcessNext(HttpMessage message, ReadOnlyMemory`1 pipeline) in D:\a\_work\1\s\sdk\core\Azure.Core\src\Pipeline\HttpPipelinePolicy.cs:line 50
 at Azure.Core.Pipeline.HttpPipelineSynchronousPolicy.Process(HttpMessage message, ReadOnlyMemory`1 pipeline) in D:\a\_work\1\s\sdk\core\Azure.Core\src\Pipeline\HttpPipelineSynchronousPolicy.cs:line 37
 at Azure.Core.Pipeline.HttpPipelinePolicy.ProcessNext(HttpMessage message, ReadOnlyMemory`1 pipeline) in D:\a\_work\1\s\sdk\core\Azure.Core\src\Pipeline\HttpPipelinePolicy.cs:line 50
 at Azure.Core.Pipeline.HttpPipelineSynchronousPolicy.Process(HttpMessage message, ReadOnlyMemory`1 pipeline) in D:\a\_work\1\s\sdk\core\Azure.Core\src\Pipeline\HttpPipelineSynchronousPolicy.cs:line 37
 at Azure.Core.Pipeline.HttpPipelinePolicy.ProcessNext(HttpMessage message, ReadOnlyMemory`1 pipeline) in D:\a\_work\1\s\sdk\core\Azure.Core\src\Pipeline\HttpPipelinePolicy.cs:line 50
 at Azure.Core.Pipeline.RedirectPolicy.<ProcessAsync>d__5.MoveNext() in D:\a\_work\1\s\sdk\core\Azure.Core\src\Pipeline\Internal\RedirectPolicy.cs:line 33
--- End of stack trace from previous location where exception was thrown ---
 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
 at Azure.Core.Pipeline.RedirectPolicy.Process(HttpMessage message, ReadOnlyMemory`1 pipeline) in D:\a\_work\1\s\sdk\core\Azure.Core\src\Pipeline\Internal\RedirectPolicy.cs:line 174
 at Azure.Core.Pipeline.HttpPipelinePolicy.ProcessNext(HttpMessage message, ReadOnlyMemory`1 pipeline) in D:\a\_work\1\s\sdk\core\Azure.Core\src\Pipeline\HttpPipelinePolicy.cs:line 50
 at Azure.Core.Pipeline.RetryPolicy.<ProcessAsync>d__11.MoveNext() in D:\a\_work\1\s\sdk\core\Azure.Core\src\Pipeline\Internal\RetryPolicy.cs:line 61
--- End of stack trace from previous location where exception was thrown ---
 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
 at Azure.Core.Pipeline.RetryPolicy.<ProcessAsync>d__11.MoveNext() in D:\a\_work\1\s\sdk\core\Azure.Core\src\Pipeline\Internal\RetryPolicy.cs:line 96
--- End of stack trace from previous location where exception was thrown ---
 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
 at Azure.Core.Pipeline.RetryPolicy.Process(HttpMessage message, ReadOnlyMemory`1 pipeline) in D:\a\_work\1\s\sdk\core\Azure.Core\src\Pipeline\Internal\RetryPolicy.cs:line 37
 at Azure.Core.Pipeline.HttpPipelinePolicy.ProcessNext(HttpMessage message, ReadOnlyMemory`1 pipeline) in D:\a\_work\1\s\sdk\core\Azure.Core\src\Pipeline\HttpPipelinePolicy.cs:line 50
 at Azure.Core.Pipeline.HttpPipelineSynchronousPolicy.Process(HttpMessage message, ReadOnlyMemory`1 pipeline) in D:\a\_work\1\s\sdk\core\Azure.Core\src\Pipeline\HttpPipelineSynchronousPolicy.cs:line 37
 at Azure.Core.Pipeline.HttpPipelinePolicy.ProcessNext(HttpMessage message, ReadOnlyMemory`1 pipeline) in D:\a\_work\1\s\sdk\core\Azure.Core\src\Pipeline\HttpPipelinePolicy.cs:line 50
 at Azure.Core.Pipeline.HttpPipelineSynchronousPolicy.Process(HttpMessage message, ReadOnlyMemory`1 pipeline) in D:\a\_work\1\s\sdk\core\Azure.Core\src\Pipeline\HttpPipelineSynchronousPolicy.cs:line 37
 at Azure.Core.Pipeline.HttpPipelinePolicy.ProcessNext(HttpMessage message, ReadOnlyMemory`1 pipeline) in D:\a\_work\1\s\sdk\core\Azure.Core\src\Pipeline\HttpPipelinePolicy.cs:line 50
 at Azure.Core.Pipeline.HttpPipelineSynchronousPolicy.Process(HttpMessage message, ReadOnlyMemory`1 pipeline) in D:\a\_work\1\s\sdk\core\Azure.Core\src\Pipeline\HttpPipelineSynchronousPolicy.cs:line 37
 at Azure.Core.Pipeline.HttpPipelinePolicy.ProcessNext(HttpMessage message, ReadOnlyMemory`1 pipeline) in D:\a\_work\1\s\sdk\core\Azure.Core\src\Pipeline\HttpPipelinePolicy.cs:line 50
 at Azure.Core.Pipeline.HttpPipelineSynchronousPolicy.Process(HttpMessage message, ReadOnlyMemory`1 pipeline) in D:\a\_work\1\s\sdk\core\Azure.Core\src\Pipeline\HttpPipelineSynchronousPolicy.cs:line 37
 at Azure.Core.Pipeline.HttpPipeline.Send(HttpMessage message, CancellationToken cancellationToken) in D:\a\_work\1\s\sdk\core\Azure.Core\src\Pipeline\HttpPipeline.cs:line 178
 at Azure.Storage.Queues.QueueRestClient.Delete(Nullable`1 timeout, CancellationToken cancellationToken) in D:\a\_work\1\s\sdk\storage\Azure.Storage.Queues\src\Generated\QueueRestClient.cs:line 139
 at Azure.Storage.Queues.QueueClient.<DeleteInternal>d__58.MoveNext() in D:\a\_work\1\s\sdk\storage\Azure.Storage.Queues\src\QueueClient.cs:line 1018
--- End of stack trace from previous location where exception was thrown ---
 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
 at Azure.Storage.Queues.QueueClient.<DeleteIfExistsInternal>d__55.MoveNext() in D:\a\_work\1\s\sdk\storage\Azure.Storage.Queues\src\QueueClient.cs:line 913
--- End of stack trace from previous location where exception was thrown ---
 at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
 at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
 at Azure.Storage.Queues.QueueClient.DeleteIfExists(CancellationToken cancellationToken) in D:\a\_work\1\s\sdk\storage\Azure.Storage.Queues\src\QueueClient.cs:line 833
 at Microsoft.Azure.WebJobs.Extensions.Storage.Queues.QueueTests.SetUp() in D:\a\_work\1\s\sdk\storage\Microsoft.Azure.WebJobs.Extensions.Storage.Queues\tests\QueueTests.cs:line 32
--IndexOutOfRangeException
 at Microsoft.Extensions.Logging.LoggerFactory.CreateLoggers(String categoryName)
 at Microsoft.Extensions.Logging.LoggerFactory.CreateLogger(String categoryName)
 at System.Collections.Concurrent.ConcurrentDictionary`2.GetOrAdd(TKey key, Func`2 valueFactory)
 at Microsoft.Extensions.Azure.AzureEventSourceLogForwarder.LogEvent(EventWrittenEventArgs eventData) in D:\a\_work\1\s\sdk\extensions\Microsoft.Extensions.Azure\src\Internal\AzureEventSourceLogForwarder.cs:line 52
 at System.Diagnostics.Tracing.EventSource.DispatchToAllListeners(Int32 eventId, Guid* childActivityID, EventWrittenEventArgs eventCallbackArgs)
pallavit commented 9 months ago

@annelo-msft , @christothes , @JoshLove-msft have we seen any instances of it lately?

christothes commented 8 months ago

I'm not aware of any.

github-actions[bot] commented 6 months ago

Hi @kasobol-msft, we deeply appreciate your input into this project. Regrettably, this issue has remained inactive for over 2 years, leading us to the decision to close it. We've implemented this policy to maintain the relevance of our issue queue and facilitate easier navigation for new contributors. If you still believe this topic requires attention, please feel free to create a new issue, referencing this one. Thank you for your understanding and ongoing support.

jsquire commented 6 months ago

No instances of this have been reported in 2+ years; closing.