Skip to content

Capture async-profiler state before EventPipe session teardown. - #136904

Merged
lateralusX merged 2 commits into
dotnet:mainfrom
lateralusX:lateralusX/eventpipe-multithreaded-session-stop
Nov 9, 2026
Merged

lateralusX merged 2 commits into
dotnet:mainfrom
lateralusX:lateralusX/eventpipe-multithreaded-session-stop

Conversation

@lateralusX

Copy link
Copy Markdown
Member

Request capture-state from allowlisted providers enabled in the stopping session before disabling tracing. Initially allowlist AsyncProfilerEventSource so buffered async-profiler events can reach the session before teardown.

Reuse provider callback lifetime tracking and invoke callbacks outside the EventPipe lock, passing the stopping session ID. Preserve normal event fan-out and the existing single-threaded runtime shutdown hook.

Abort the stopping session's blocked writers before invoking capture-state. Make capture-time writes nonblocking across sessions, with an owner-thread assertion guarding the per-thread scope.

Add native coverage for callback ordering, session identity, provider selection, fan-out, and cross-session backpressure. Add a managed runtime-async test that validates the correlated profiler context lifecycle at session stop.

Capture remains best effort rather than a strict event-completeness boundary.

Request capture-state from allowlisted providers enabled in the stopping
session before disabling tracing. Initially allowlist AsyncProfilerEventSource
so buffered async-profiler events can reach the session before teardown.

Reuse provider callback lifetime tracking and invoke callbacks outside the
EventPipe lock, passing the stopping session ID. Preserve normal event fan-out
and the existing single-threaded runtime shutdown hook.

Abort the stopping session's blocked writers before invoking capture-state.
Make capture-time writes nonblocking across sessions, with an owner-thread
assertion guarding the per-thread scope.

Add native coverage for callback ordering, session identity, provider
selection, fan-out, and cross-session backpressure. Add a managed runtime-async
test that validates the correlated profiler context lifecycle at session stop.

Capture remains best effort rather than a strict event-completeness boundary.
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 3 pipeline(s).
12 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@lateralusX

Copy link
Copy Markdown
Member Author

/azp run runtime-nativeaot-outerloop

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 1 pipeline(s).

@lateralusX
lateralusX merged commit b2c0357 into dotnet:main Nov 9, 2026
153 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants