Skip to content
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.
This repository has been archived by the owner on Oct 12, 2022. It is now read-only.

DeadLock over Microsoft.ApplicationInsights.EventSourceListener.EventSourceTelemetryModule.OnEventSourceCreated() call #109

Closed

Description

We run into a deadlock issue over Microsoft.ApplicationInsights.EventSourceListener.EventSourceTelemetryModule.OnEventSourceCreated() function.

0:013> !critlist
CritSec at 000000acea379ae0. Owned by thread 13.
Waiting Threads: 10 12 15 16 27 28
so, the multiple threads hang on thread# 13.

0:013> !locks
CritSec +ea379ae0 at 000000acea379ae0
WaiterWoken No
LockCount 6
RecursionCount 1
OwningThread 868
EntryCount 0
ContentionCount 6

0:013> ~~[0x868]
. 13 Id: 1700.868 Suspend: 0 Teb: 00007ff5ff014000 Unfrozen Start: clr!Thread::intermediateThreadProc (00007ff86b57598c)
Priority: 0 Priority class: 32 Affinity: 3

Thread # 13 and Thread# 17 are deadlock on each other

Thread 17 takes a lock on the TelmetryModule
Thread 17 then takes a lock on EventListenersLock

Thread 13 takes a lock on EventListenersLock
Thread 13 then takes a lock on the TelmetryModule

Thread 13
000000ac829ace78 00007ff8749e0c6a [HelperMethodFrame_1OBJ: 000000ac829ace78] System.Threading.Monitor.Enter(System.Object) << Locks on Microsoft.ApplicationInsights.EventSourceListener.EventSourceTelemetryModule
000000ac829acf70 00007ff80c9788fd Microsoft.ApplicationInsights.EventSourceListener.EventSourceTelemetryModule.OnEventSourceCreated(System.Diagnostics.Tracing.EventSource)
000000ac829acfc0 00007ff86a12bc27 System.Diagnostics.Tracing.EventSource.AddListener(System.Diagnostics.Tracing.EventListener)
000000ac829ad030 00007ff86a1d40ca System.Diagnostics.Tracing.EventListener.AddEventSource(System.Diagnostics.Tracing.EventSource)
000000ac829ad0a0 00007ff86a1d341d System.Diagnostics.Tracing.EventSource.Initialize(System.Guid, System.String, System.String[]) << Locks on EventListener.EventListenersLock
000000ac829ad130 00007ff86a13260f System.Diagnostics.Tracing.EventSource..ctor(System.Diagnostics.Tracing.EventSourceSettings, System.String[])

Thread 17
000000ac8a20e068 00007ff8749e0c6a [HelperMethodFrame_1OBJ: 000000ac8a20e068] System.Threading.Monitor.Enter(System.Object) << Locks on EventListener.EventListenersLock
000000ac8a20e160 00007ff86a9f440c System.Diagnostics.Tracing.EventSource.SendCommand(System.Diagnostics.Tracing.EventListener, Int32, Int32, System.Diagnostics.Tracing.EventCommand, Boolean, System.Diagnostics.Tracing.EventLevel, System.Diagnostics.Tracing.EventKeywords, System.Collections.Generic.IDictionary2) 000000ac8a20e1e0 00007ff86a1a72d7 System.Diagnostics.Tracing.EventListener.EnableEvents(System.Diagnostics.Tracing.EventSource, System.Diagnostics.Tracing.EventLevel, System.Diagnostics.Tracing.EventKeywords, System.Collections.Generic.IDictionary2)
000000ac8a20e240 00007ff80c98ac07 Microsoft.ApplicationInsights.EventSourceListener.EventSourceTelemetryModule.EnableAsNecessary(System.Diagnostics.Tracing.EventSource)
000000ac8a20e2c0 00007ff80c98a853 Microsoft.ApplicationInsights.EventSourceListener.EventSourceTelemetryModule.Initialize(Microsoft.ApplicationInsights.Extensibility.TelemetryConfiguration) << Locks on Microsoft.ApplicationInsights.EventSourceListener.EventSourceTelemetryModule

Reference:
https://github.com/Microsoft/ApplicationInsights-dotnet-logging/blob/63a6886743dc025fe523324921c3667525d6ee95/src/Adapters/EventSource.Netstandard13/EventSourceTelemetryModule.cs#L122-L148

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

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions