Skip to content

fix: Don't free tracer context in DllMain during process termination - #544

Open
mschilling0 wants to merge 1 commit into
oneapi-src:masterfrom
mschilling0:dev_windows
Open

mschilling0 wants to merge 1 commit into
oneapi-src:masterfrom
mschilling0:dev_windows

Conversation

@mschilling0

@mschilling0 mschilling0 commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Matches what's being done here: https://learn.microsoft.com/en-us/windows/win32/dlls/dllmain

lpvReserved is "non-NULL" when process is terminating and its not safe to call the tracer context destructor there.

Guards against a use-after-free occasionally on PyTorch Profiler on Windows.

Matches what's being done here: https://learn.microsoft.com/en-us/windows/win32/dlls/dllmain

`lpvReserved` is "non-NULL" when process is terminating and its not safe
to call the tracer context destructor there.

Signed-off-by: Schilling, Matthew <matthew.schilling@intel.com>
@mschilling0 mschilling0 changed the title fix: Don't free contexts in DllMain during process termination fix: Don't free tracer context in DllMain during process termination Oct 22, 2026
@mschilling0
mschilling0 marked this pull request as ready for review October 22, 2026 17:42

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant