You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
AppLog drops lines written on the way out of the process, so clean shutdown is usually lost #174
AppLog.write hands the line to a background queue (AppLog.swift:28) and returns. When the caller is on its way out of the process, the line races the teardown and is frequently lost.
The site that matters today is CrashReporter.markClean() (CrashReporter.swift:65-68), which runs from the NSApplication.willTerminateNotification observer registered in install() (:45-47). AppKit posts that notification and then exits, so clean shutdown is written only if the log queue happens to get scheduled first.
Measured with an AppKit app reproducing the sequence — enqueue on a serial DispatchQueue, then NSApp.terminate(nil):
runs=100 landed=58 lost=42
Consistent with what is on disk here: the current 1.2M PokeTokenBar.log has 1 launch: line and 0 clean shutdown lines; the rotated 2.0M PokeTokenBar.old.log has 1 and 1.
The consequence is not just a missing line. clean shutdown is the human-readable half of the shutdown record, so the log reads as if sessions end abruptly even when they don't. The marker file itself is removed synchronously (FileManager.removeItem, :66), so the detection in install():37 is unaffected — this is a diagnostics defect, not a false crash report.
Fix shape: an AppLog.flush() that does queue.sync {}, called on the paths that exit right after logging. Sweep for callers, not just this one — #163 adds a second such site in applicationDidFinishLaunching.
Class, for docs/reference/defect-log.md: an async logger is not a logger on an exit path. Any AppLog.write whose caller reaches exit() in the same turn needs a flush, and the absence of the line cannot be used as evidence that the branch did not run.
Activity
fix: route AppLog.writeAndFlush through the tested backend
fix: flush AppLog on the willTerminate exit path (#174) (#180)
Merge upstream/main (11 commits) into the fork
fix: flush AppLog on the willTerminate exit path (chattymin#174) (cha…
fix: let an overlapping update check wait for the one in flight (review)
Stop duplicate instances and fix update-check edge cases (SP4 batch D) (