CrashHandler: install once and dispatch each crash once
Merged
UT
5d ago+67+67+01234567890123456789-4-4-0123456789
Description
Split out of #1570 so the HTML5 runtime PR stays about HTML5. The three commits are by @jeremybernstein, unchanged:
CrashHandler.initializeno longer wraps a previousCrashHandler, so repeated app boots (Robolectric runs one per test class) do not grow the handler chain.- A failed crash-file save is logged instead of handing the crash to the default handler a second time.
CrashFingerprint.extractcaps each line at the same 4096 charsGuestOutputTailuses; one very long line made some patterns backtrack for minutes.
Adds CrashHandlerTest covering repeated init and a failed save.
Recording
None; no UI change.
Type of Change
- Bug fix
- Performance / stability improvement
- Compatibility improvements
- Other (requires prior approval)
Checklist
- If I have access to
#code-changes, I have discussed this change there and it has been green-lighted. If I do not have access, I have still provided clear context in this PR. If I skip both, I accept that this change may face delays in review, may not be reviewed at all, or may be closed. - This change aligns with the current project scope (core functionality, stability, or performance). If not, it has been explicitly approved beforehand.
- I have attached a recording of the change.
- I have read and agree to the contribution guidelines in
CONTRIBUTING.md.
Summary by cubic
Fixes CrashHandler so repeated app boots no longer grow the handler chain and each crash reaches the default handler exactly once.
CrashHandler.initializeunwraps an already-installedCrashHandlerinstead of wrapping it again per boot.- Failed crash-file saves are logged rather than dispatched to the default handler a second time.
CrashFingerprint.extractcaps each line at 4096 chars, matchingGuestOutputTail, to prevent quadratic backtracking on very long lines.- Adds
CrashHandlerTestcovering repeated init and a failed save.
Summary by CodeRabbit
- Bug Fixes
- Improved crash handling so repeated initialization does not cause an exception to be passed to the original handler multiple times.
- Improved handling when saving a crash report fails, while preserving the normal exception handoff.
- Applied a consistent 4,096-character limit to lines used in crash fingerprinting and retained guest output.