postmaster: async-signal-safe frame dump in the crash handler - #100
postmaster: async-signal-safe frame dump in the crash handler#100brandonros wants to merge 1 commit into
Conversation
backtrace_symbols_fd() is not on the async-signal-safe list. On macOS it calls dladdr(), which takes dyld's locks; on glibc the hazard is backtrace()'s first call, which dlopen()s libgcc_s. A fault inside the allocator or the loader then hangs the handler instead of crashing, so the process never reaches raise() and leaves no core file. Write raw frame addresses with write(2) into a bounds-clamped stack buffer instead, on Linux and macOS, and leave symbolizing to atos / addr2line. The lint-determinism allow row grows by the two extra write(2) sites. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 8 included reviews per hour; 4 remain after this review. 📝 WalkthroughWalkthroughThe fatal-signal handler now emits raw hexadecimal frame addresses on Linux and macOS. It flushes buffered output across multiple writes. The lint configuration allows the additional write calls. ChangesCrash signal backtrace output
Estimated code review effort: 2 (Simple) | ~10 minutes Merge Risk: ⚪ Minimal · up to Crash backtraces now emit raw hexadecimal frame addresses on Linux and macOS rather than symbolized frames, avoiding the unsafe symbolization call in the fatal-signal path. No merge-blocking risk remains. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
`backtrace_symbols_fd()` is not async-signal-safe: on macOS it calls `dladdr()` (dyld locks), and on glibc the first `backtrace()` call `dlopen()`s libgcc_s. A fault inside the allocator or the loader then hangs the handler instead of crashing, so the process never reaches `raise()` and leaves no core file.
This writes raw frame addresses with `write(2)` into a bounds-clamped stack buffer (Linux and macOS) and leaves symbolizing to `atos` / `addr2line`. The lint-determinism allow row grows by the two extra `write(2)` sites.
Split out of the objkv series (#92) as an independent fix; it does not depend on any of it.
🤖 Generated with Claude Code
Summary by CodeRabbit