Skip to content

In-proc event listener listening to native runtime event source events crashes on Mono Linux #66854

Description

@kouvel

In PR #66765 I tried to use an in-proc EventListener to listen to a thread pool event. On Mono, this appears to work fine on Windows but is crashing at the following stack on Linux. Also crashed on OSX in the PR's CI.

The test is in System.Threading.ThreadPool tests named 'CooperativeBlockingCanCreateThreadsFaster'. For now, I'll disable the test on Mono in that PR.

  =================================================================
        Managed Stacktrace:
  =================================================================
          at <unknown> <0xffffffff>
          at System.Runtime.InteropServices.GCHandle:InternalGet <0x00079>
          at System.Runtime.InteropServices.GCHandle:get_Target <0x00047>
          at HandleManager:FromHandle <0x000ab>
          at System.Threading.WaitSubsystem:SetEvent <0x0002b>
          at System.Threading.EventWaitHandle:Set <0x0004b>
          at System.Diagnostics.Tracing.EventPipeEventDispatcher:StopDispatchTask <0x0009b>
          at System.Diagnostics.Tracing.EventPipeEventDispatcher:CommitDispatchConfiguration <0x0007b>
          at System.Diagnostics.Tracing.EventPipeEventDispatcher:RemoveEventListener <0x000cb>
          at System.Diagnostics.Tracing.EventListener:RemoveReferencesToListenerInEventSources <0x002eb>
          at System.Diagnostics.Tracing.EventListener:Dispose <0x0010f>
          at <>c:<CooperativeBlockingCanCreateThreadsFaster>b__38_0 <0x0052f>
          at System.Object:runtime_invoke_void__this__ <0x00091>
          at <unknown> <0xffffffff>
          at System.Reflection.RuntimeMethodInfo:InternalInvoke <0x000b9>
          at System.Reflection.RuntimeMethodInfo:InvokeWorker <0x0009f>
          at System.Reflection.RuntimeMethodInfo:Invoke <0x001d3>
          at System.Reflection.MethodBase:Invoke <0x00049>
          at Microsoft.DotNet.RemoteExecutor.Program:Main <0x00313>
          at <Module>:runtime_invoke_int_object <0x00091>
  =================================================================
      System.Threading.ThreadPools.Tests.ThreadPoolTests.CooperativeBlockingCanCreateThreadsFaster [FAIL]
        Exit code was 134 but it should have been 42
        Expected: True
        Actual:   False
        Stack Trace:
          /_/src/Microsoft.DotNet.RemoteExecutor/src/RemoteInvokeHandle.cs(239,0): at Microsoft.DotNet.RemoteExecutor.RemoteInvokeHandle.Dispose(Boolean disposing)
          /_/src/Microsoft.DotNet.RemoteExecutor/src/RemoteInvokeHandle.cs(57,0): at Microsoft.DotNet.RemoteExecutor.RemoteInvokeHandle.Dispose()
          /home/user/runtime/src/libraries/System.Threading.ThreadPool/tests/ThreadPoolTests.cs(914,0): at System.Threading.ThreadPools.Tests.ThreadPoolTests.CooperativeBlockingCanCreateThreadsFaster()
          /home/user/runtime/src/mono/System.Private.CoreLib/src/System/Reflection/RuntimeMethodInfo.Mono.cs(386,0): at System.Reflection.RuntimeMethodInfo.InvokeWorker(Object obj, BindingFlags invokeAttr, Span`1 parameters)
    Finished:    System.Threading.ThreadPool.Tests

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

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions