mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-19 15:09:58 -04:00
Let the first failure report end the run whole when another thread crashes or hits a fatal error beside it.
The platform layer calls the crash handler on every thread that faults, without waiting for the others (win32.c crash_veh, crash_filter), and main.c crash_handler ended any second entry with plat_exit(71) at once. So a second fault during the first report cut it after its first lines, together with its wait for a save Commit (fs_save_crash_wait) and RivaTuner's restore; the audit's probe showed it in 3 of 3 runs. fatal_end had no guard at all and none shared with the crash report: a crash during a FATAL's end wrote a whole crash report whose "FATAL: access violation" became the log's last FATAL line (the one the launcher shows) and replaced code 70 with 71, and a FATAL during a crash report cut it with code 70. dispatch.c rt_ending_enter is the one guard for both ends: the first caller reports and ends the process; the same thread again (a failure inside its own report) ends at once with its own code (crash_handler keeps plat_exit(71), fatal_end plat_terminate(code)); another thread waits in 10 ms sleeps, logging nothing since it may hold the log queue's lock, until the process ends, and after 30 s ends it with 71 should the first report hang. fatal_end calls it first; crash_handler calls it in place of its own busy flag. Reproduced before the change by tests/fatal_exit_check.py's new cases, which failed on the old guards: two faults at once (report lines 2 and 3 missing), a fault during rt_fatal (a crash report after the FATAL) and rt_fatal during a crash report (exit 70, the report cut). They pass now, with the earlier cases and the static check that crash_handler starts with the shared guard; the compile checks pass. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -315,8 +315,9 @@ static volatile int32_t mode_done;
|
||||
static int mode_rc;
|
||||
|
||||
static void crash_handler(const PlatCrash *x) {
|
||||
static volatile int32_t busy;
|
||||
if (plat_xchg32(&busy, 1)) plat_exit(71);
|
||||
// shared with the fatal error's end (dispatch.c rt_ending_enter): another thread's fault or fatal error waits there
|
||||
// while this report is written; a fault inside this thread's own report ends the process at once
|
||||
if (!rt_ending_enter()) plat_exit(71);
|
||||
if (__atomic_load_n(&mode_done, __ATOMIC_ACQUIRE) && x->module) {
|
||||
rt_log("exit: %s (%#x) in %s while the process was ending, after its work was done and saved%s: the run ends "
|
||||
"with its own code %d", x->what, x->code, *x->module ? x->module : "code outside every module",
|
||||
|
||||
Reference in New Issue
Block a user