Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exception "Invalid operation on start activity cache. Fail to record the activity." #103

Closed
dstj opened this issue Oct 1, 2020 · 3 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@dstj
Copy link

dstj commented Oct 1, 2020

Using 2.2.0-beta1 w/ ApplicationInsights 2.14.0, I have got the following error in my logs.

    "RenderedMessage": "Invalid operation on start activity cache. Fail to record the activity.",
    "Exception": "System.InvalidOperationException: Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.
    at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
    at System.Collections.Generic.Dictionary`2.TryGetValue(TKey key, TValue& value)
    at Microsoft.ServiceProfiler.DictionaryExtension.GetOrAdd[TKey,TValue](IDictionary`2 dictionary, TKey key, Func`2 valueFactory)
    at Microsoft.ServiceProfiler.Sampling.SampleActivityContainer.AddSample(SampleActivity activity)
    at ServiceProfiler.EventPipe.Client.EventListeners.TraceSessionListener.AppendSampleActivity(SampleActivity activity)",

This happened twice back to back, early on after starting the process, then no longer. And I noticed that no Upload logs are presents (no idea if that related?). I restarted the process after from scratch and the error did not occur.

Attached are all the ServiceProfiler logs leading to the error and some after (noticed another exception at L300): profiler-error-logs.txt (I tried to format the JSON logs as best I could)

Environment:
Dev workstation, Windows 10 Pro, .NET Core 3.1.402

@xiaomi7732
Copy link
Member

@dstj thanks for your feedback. I'll take a look.

@xiaomi7732 xiaomi7732 self-assigned this Oct 5, 2020
@xiaomi7732 xiaomi7732 added the bug Something isn't working label Oct 5, 2020
@xiaomi7732
Copy link
Member

This could trace back to: dotnet/runtime#26868.
I'll issue an fix to the bug.

@xiaomi7732 xiaomi7732 added this to the vNext milestone Oct 5, 2020
@xiaomi7732
Copy link
Member

The fix is released with the latest package: https://www.nuget.org/packages/Microsoft.ApplicationInsights.Profiler.AspNetCore/2.2.0-beta2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants