Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Concurrent exceptions might cause createdump to fail #82989

Closed
hoyosjs opened this issue Mar 5, 2023 · 1 comment
Closed

Concurrent exceptions might cause createdump to fail #82989

hoyosjs opened this issue Mar 5, 2023 · 1 comment

Comments

@hoyosjs
Copy link
Member

hoyosjs commented Mar 5, 2023

Discovered while reviewing #82449. If there's a flurry of exceptions we may get many threads here:

  * frame #0: 0x00007ffff78b589b libcoreclr.so`PROCCreateCrashDump(argv=size=16, errorMessageBuffer=0x0000000000000000, cbErrorMessageBuffer=0) at process.cpp:2169:9
    frame #1: 0x00007ffff78b6bd7 libcoreclr.so`::PROCCreateCrashDumpIfEnabled(signal=<unavailable>, siginfo=<unavailable>) at process.cpp:2459:9
    frame #2: 0x00007ffff7885b7b libcoreclr.so`invoke_previous_action(action=<unavailable>, code=11, siginfo=0x00007fffef453af0, context=0x00007fffef4539c0, signalRestarts=<unavailable>) at signal.cpp:416:5
    frame #3: 0x00007ffff7885237 libcoreclr.so`sigsegv_handler(code=11, siginfo=0x00007fffef453af0, context=0x00007fffef4539c0) at signal.cpp:623:5

The problem is if two threads get to this state, both launch createdump and one is able to ptrace, the other one fails and potentially takes down the process before createdump gets to freeze threads.

@ghost ghost added the untriaged New issue has not been triaged by the area owner label Mar 5, 2023
@ghost
Copy link

ghost commented Mar 5, 2023

Tagging subscribers to this area: @tommcdon
See info in area-owners.md if you want to be subscribed.

Issue Details

Discovered while reviewing #82449. If there's a flurry of exceptions we may get many threads here:

  * frame #0: 0x00007ffff78b589b libcoreclr.so`PROCCreateCrashDump(argv=size=16, errorMessageBuffer=0x0000000000000000, cbErrorMessageBuffer=0) at process.cpp:2169:9
    frame #1: 0x00007ffff78b6bd7 libcoreclr.so`::PROCCreateCrashDumpIfEnabled(signal=<unavailable>, siginfo=<unavailable>) at process.cpp:2459:9
    frame #2: 0x00007ffff7885b7b libcoreclr.so`invoke_previous_action(action=<unavailable>, code=11, siginfo=0x00007fffef453af0, context=0x00007fffef4539c0, signalRestarts=<unavailable>) at signal.cpp:416:5
    frame #3: 0x00007ffff7885237 libcoreclr.so`sigsegv_handler(code=11, siginfo=0x00007fffef453af0, context=0x00007fffef4539c0) at signal.cpp:623:5

The problem is if two threads get to this state, both launch createdump and one is able to ptrace, the other one fails and potentially takes down the process before createdump gets to freeze threads.

Author: hoyosjs
Assignees: -
Labels:

area-Diagnostics-coreclr

Milestone: -

@hoyosjs hoyosjs added bug and removed untriaged New issue has not been triaged by the area owner labels Mar 5, 2023
@hoyosjs hoyosjs added this to the 8.0.0 milestone Mar 5, 2023
@mikem8361 mikem8361 self-assigned this Mar 5, 2023
mikem8361 added a commit to mikem8361/runtime that referenced this issue Aug 2, 2023
Only allow one thread at a time to generate a core dump.

Issue: dotnet#82989
@tommcdon tommcdon modified the milestones: 8.0.0, 9.0.0 Aug 7, 2023
mikem8361 added a commit that referenced this issue Aug 8, 2023
* Serialize createdump core dump generation

Only allow one thread at a time to generate a core dump.

Issue: #82989

* Code review feedback. Move serializing code into PROCCreateCrashDump

* Code review feedback - put while (true) around poll()'s
@ghost ghost locked as resolved and limited conversation to collaborators Sep 7, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants