Commit d778a6a
[Diagnostics] Add in-proc crash report watchdog (#128281)
Adds a watchdog for the in-proc crash report generation so a hung crash
reporter cannot leave the process stuck indefinitely.
The in-proc crash reporter runs while the process is already handling a
fatal signal. If the reporter hangs, OS-level watchdogs are not reliable
across all relevant app locations, especially worker/background-thread
crashes. This bounds reporter execution time and ensures the process
eventually terminates instead of remaining stuck.
The watchdog is initialized outside the crash path, uses a pipe-backed
notification channel, and keeps the crash-reporting path limited to
async-signal-safe `write()` calls. If report generation starts but does
not finish before the configured timeout, the watchdog aborts the
process with SIGABRT.
- Adds `inproccrashreportwatchdog.{h,cpp}`.
- Arms the watchdog when `InProcCrashReporter::CreateReport()` begins
and disarms it when report generation exits.
- Uses a detached watchdog thread plus a nonblocking pipe instead of
semaphores for POSIX compatibility.
- Blocks fatal signals on the watchdog thread so process-directed crash
signals do not land there.
- Adds `DOTNET_CrashReportTimeoutSeconds`.
- Default: `30`
- `0` disables the watchdog for diagnostics/debugging.
- Keeps watchdog initialization best-effort; if initialization fails,
crash reporting proceeds without the watchdog.
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>1 parent a82b355 commit d778a6a
7 files changed
Lines changed: 543 additions & 0 deletions
File tree
- src/coreclr
- debug/crashreport
- pal/src/include/pal
- vm
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
| 8 | + | |
8 | 9 | | |
9 | 10 | | |
10 | 11 | | |
| 12 | + | |
11 | 13 | | |
12 | 14 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
| |||
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| 19 | + | |
18 | 20 | | |
19 | 21 | | |
20 | 22 | | |
| |||
608 | 610 | | |
609 | 611 | | |
610 | 612 | | |
| 613 | + | |
611 | 614 | | |
612 | 615 | | |
613 | 616 | | |
| |||
746 | 749 | | |
747 | 750 | | |
748 | 751 | | |
| 752 | + | |
| 753 | + | |
749 | 754 | | |
750 | 755 | | |
751 | 756 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
74 | 74 | | |
75 | 75 | | |
76 | 76 | | |
| 77 | + | |
77 | 78 | | |
78 | 79 | | |
79 | 80 | | |
| |||
0 commit comments