Sitelet https://github.com/microsoft/ApplicationInsights-dotnet/issues/1313
Skip to content

Synchronize access to HttpContext #1313

Description

HttpContext class is not thread safe. So accessing it from telemetry initializers on the different threads have to be synchronized. Today enabling Application Insights on highly async web site with many tasks running in parallel may cause failures or hangs.

000000aa`844d7fe0 00007ffc`97b8d704 mscorlib_ni!System.Collections.Generic.Dictionary`2[[System.__Canon, mscorlib],[System.__Canon, mscorlib]].FindEntry(System.__Canon)+0x10c
000000aa`844d8050 00007ffc`39d0cb71 mscorlib_ni!System.Collections.Generic.Dictionary`2[[System.__Canon, mscorlib],[System.__Canon, mscorlib]].TryGetValue(System.__Canon, System.__Canon ByRef)+0x14
000000aa`844d8090 00007ffc`39d0cae6 Microsoft_AspNetCore_Http_Features!Microsoft.AspNetCore.Http.Features.FeatureCollection.get_Item(System.Type)+0x41
000000aa`844d80d0 00007ffc`39f1afd2 Microsoft_AspNetCore_Http_Features!Microsoft.AspNetCore.Http.Features.FeatureCollection.Get[[System.__Canon, mscorlib]]()+0x36
000000aa`844d8110 00007ffc`39f1ae38 Microsoft_AspNetCore_Http_Features!Microsoft.AspNetCore.Http.Features.FeatureReferences`1[[System.__Canon, mscorlib]].UpdateCached[[System.__Canon, mscorlib],[System.__Cano
non>, Int32, Boolean)+0x72
000000aa`844d8180 00007ffc`39f1a3f6 Microsoft_AspNetCore_Http!Microsoft.AspNetCore.Http.Features.RequestCookiesFeature.get_Cookies()+0xc8

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions