mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-18 02:39:57 -04:00
Open the log's end reserve only when the process is ending, not at a bug capture's log sync in play.
The review of the log tail change found that main.c log_sink opened the 4 MiB reserve past the cap on g_log_final as well as on g_log_ending. bugcap.c write_log_tail calls rt_log_sync in play, which sets g_log_final, so after a bug capture in a trace = perf session past the cap, ordinary play lines filled the reserve (about 6 minutes at 12 KB/s), the end's lines were dropped again, and the "end of the run follows" line came mid-run. The reserve is now keyed on g_log_ending alone, as E-10's design had it. The ends that relied on rt_log_sync now call rt_log_ending first: dispatch.c fatal_end and main.c crash_handler right after their guard, vk_device.c lost_wait_exit's watchdog before its sync, and plat_exit through the new main.c log_sync_ending (plat_exit_hook in a game run), so every path that ends through plat_exit marks the end too. rt_exit_begin and perf_summary_flush call it as before. Not reproduced in the game before the change. tests/log_cap_check.py gains a capture case (rt_log_sync in play, 1000 more play lines, then the end): on the code before this change 58 play lines took the reserve, the end line came at the sync and no end line reached the file; now no play line passes the cap and the end's lines fill the reserve. A fatal case runs rt_log_ending and then rt_log_sync, and static checks hold crash_handler, log_sync_ending, fatal_end and lost_wait_exit to calling rt_log_ending before rt_log_sync. log_cap_check, fatal_exit_check (with a stand-in for rt_log_ending) and the compile checks of main.c, dispatch.c and vk_device.c pass, with no new -Wall warnings. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -103,6 +103,7 @@ int rt_ending_enter(void) {
|
||||
static void fatal_end(int code, const char *fmt, va_list ap) __attribute__((noreturn));
|
||||
static void fatal_end(int code, const char *fmt, va_list ap) {
|
||||
if (!rt_ending_enter()) plat_terminate(code); // a fatal error inside this thread's own report: no second one
|
||||
rt_log_ending(); // the report reaches the log file past its cap (main.c log_sink)
|
||||
rt_log_sync(); // main.c: the lines queued for the log thread, then these, written here
|
||||
rt_log_raw("FATAL: ", 7);
|
||||
rt_vlogf(fmt, ap);
|
||||
|
||||
Reference in New Issue
Block a user