[CreateDump] Use _exit after createdump launch failures - #133742
Merged
mdh1418 merged 2 commits intoSep 14, 2026
Merged
Conversation
Avoid running inherited PAL shutdown callbacks in the forked child when the createdump handshake or exec fails. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
mdh1418
requested review from
hoyosjs,
jkotas and
lateralusX
and
a lite review from Copilot
September 11, 2026 20:31
|
Azure Pipelines: Successfully started running 3 pipeline(s). 13 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @steveisok, @tommcdon, @dotnet/dotnet-diag |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The analogous NativeAOT Unix failure paths still need the same fix or explicit scoping.
Get a fresh assessment by requesting another Copilot review.
Pull request overview
This PR prevents failed CoreCLR createdump launcher children from running inherited shutdown cleanup that can remove the parent’s diagnostic endpoints.
Changes:
- Replaces
exit(-1)with_exit(EXIT_FAILURE)for handshake andexecvefailures. - Preserves diagnostic sockets and pipes when launches fail.
- NativeAOT’s analogous Unix paths remain unchanged.
File summaries
| File | Description |
|---|---|
src/coreclr/pal/src/thread/process.cpp |
Safely terminates failed CoreCLR createdump launcher children. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 1
- Review effort level: Lite
jkotas
approved these changes
Sep 11, 2026
Use _exit for NativeAOT forked-child handshake and exec failures so inherited process-exit handlers cannot shut down the parent diagnostic server. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
jkotas
approved these changes
Sep 14, 2026
Member
|
/backport to release/11.0 |
commented
Sep 15, 2026
Contributor
|
Started backporting to |
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #133733
Use
_exit(EXIT_FAILURE)instead ofexit(-1)when the forkedcreatedumplauncher child fails before completingexecve.On Unix, CoreCLR forks a temporary child and expects it to replace itself with
createdump. If the parent/child synchronization handshake fails orexecve(createdump)fails, the child is still a forked copy of the managed runtime.Calling
exit()in that child runs inherited process destructors. In particular, the PAL process-shutdown destructor invokes the CoreCLR shutdown callback, which cleans up the debugger transport and diagnostic server. Because the child shares the parent's filesystem namespace, that cleanup unlinks paths belonging to the still-running parent:The parent runtime remains alive and retains its diagnostic listener file descriptor, but new diagnostic clients cannot connect after the Unix-domain socket pathname has been removed.
Cleanup behavior before this change
On a child failure:
The kernel eventually closed the child's file descriptors when the child terminated, but
exit()first ran userspace cleanup that belonged to the parent runtime. Unlinking the shared endpoint paths affected the parent even though closing the child's descriptor references alone would not have affected it.Cleanup behavior after this change
On a child failure:
The child still closes all of its file descriptor references as part of kernel process termination. The difference is that it no longer performs inherited userspace teardown against copied runtime state.
On a successful
execve, the existingSOCK_CLOEXECandFD_CLOEXECflags continue to close inherited diagnostic descriptors in the newcreatedumpprocess. This change affects only failure paths before a successful exec.Both forked-child failure paths are updated:
createdumpbinary.Validation
The issue was reproduced by running a target with its colocated
createdumpset to mode0644.Before the change:
dotnet-dump collectreached the target runtime.execve(createdump)failed withEACCES.After the change:
CoreCLR Release was rebuilt successfully with the change.