mirror of
https://github.com/tangerineturtle1/NX2navi.git
synced 2026-11-19 23:49:56 -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:
@@ -880,6 +880,7 @@ static void lost_wait_exit(void *arg) {
|
||||
int watchdog = arg != NULL;
|
||||
for (int t = 0; t < LOST_EXIT_MS + (watchdog ? 0 : 2000); t += 50) plat_sleep_ms(50);
|
||||
if (watchdog) {
|
||||
rt_log_ending(); // its line reaches the log file past its cap (main.c log_sink)
|
||||
rt_log_sync(); // the queue's locks only tried (bounded): their holder may be the thread that hangs
|
||||
rt_log("vk: the end of the run did not finish in %d s; ending it", LOST_EXIT_MS / 1000);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user