-
Notifications
You must be signed in to change notification settings - Fork 2.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: overhaul the crash handler #10203
Conversation
❌ @paperdave 3 files with test failures on linux-x64: |
❌ @paperdave 3 files with test failures on linux-x64-baseline: |
❌ @paperdave 2 files with test failures on bun-darwin-aarch64:
|
❌ @paperdave 2 files with test failures on bun-darwin-x64: |
src/bun.zig
Outdated
@@ -1591,14 +1601,23 @@ pub fn reloadProcess( | |||
const rc = bun.windows.TerminateProcess(@ptrFromInt(std.math.maxInt(usize)), win32.watcher_reload_exit); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
const rc = bun.windows.TerminateProcess(@ptrFromInt(std.math.maxInt(usize)), win32.watcher_reload_exit); | |
const rc = bun.windows.TerminateProcess(bun.windows.GetCurrentProcess(), win32.watcher_reload_exit); |
start_time = std.time.nanoTimestamp(); | ||
log_ = logger.Log.init(allocator); | ||
|
||
var log = &log_; | ||
|
||
var panicker = MainPanicHandler.init(log); | ||
MainPanicHandler.Singleton = &panicker; | ||
// var panicker = MainPanicHandler.init(log); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
delete
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A few comments. Mostly wondering if there are four missing bun.handleErrorReturnTrace(err, @errorReturnTrace());
in run_command.zig
This deletes the existing
crash_handler.zig
,panic_handler.zig
,report.zig
, and replaces it with a new crash handler which runs in all release builds. The primary goal of this is to allow all users to report useful crash reports to us using a "Trace String", a url-safe encoding of a stack trace or error return trace which can be demangled after the fact.The tracestrings are all URLs from the base
https://bun.report
, where visiting the URL in a browser will redirect to a prompt to submit a GitHub issue, pre-filled with the remapped stack trace. Going to the homepage will show a frontend tool to just do the remapping.Bun also adds
--verbose-error-trace
, which in platforms with error return traces enabled, these trace strings will be printed for any place we catch an error. This will help places we see users run into bun install errors but we don't know where it is at; We can ask them to run with the flag and share trace strings.TODOs:
bun.report
--watch
reload-on-crash behavior worksmain
returning an error a better experience.bun.handleErrorReturnTrace
and--verbose-error-trace
Revert changes intoMake Bun.unsafe.segfault private.Bun.unsafe
/ changeBun.unsafe.segfault
intoBun.unsafe.crash
/ remove that API entirely.Considering TODOs
I might do some more breaking changes to the format of trace-strings before the main merge. That is what I'm most worried about for now.