Repository navigation
fix(android): keep native tombstones and record runtime crash breadcrumbs - #129
Open
ammarahm-ed wants to merge 1 commit into
Open
ammarahm-ed wants to merge 1 commit into
ammarahm-ed wants to merge 1 commit into
Conversation
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the
|
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Port of NativeScript/android#2007 to both the Node-API and the direct runtime.
SIG_handler(hereSIGHandler.h) was installed forSIGABRTandSIGSEGVand threw aNativeScriptExceptionfrom inside the signal handler. The unwinder cannot cross the kernel's signal frame, so the throw never reached a catch block, and installing aSIGSEGVhandler displaced debuggerd, so no tombstone was written. The handler destroyed the diagnostics and the process died anyway.CrashBreadcrumbsreplaces it in bothruntime/android/napi/sighandler/andruntime/android/jsi/sighandler/, as the upstream code with no changes:pwrite(2)calls to a file opened at startup (files/.ns-crash-breadcrumb), then restores the previous disposition and returns, so the faulting instruction re-faults and debuggerd writes the tombstone with the kernel's originalsiginfo. Signals raised byabortorkill(si_code <= 0) are re-raised instead. It is installed forSIGSEGV,SIGABRT,SIGBUS,SIGILLandSIGFPEwithSA_SIGINFO | SA_ONSTACK.ModuleScope, which also restores the enclosing module on throw paths).TNS.Nativeat error level (not fatal, which would claim bionic's one abort-message slot), and truncates it.std::set_terminate(LogAndAbortUncaught)is unchanged. The disabled spec that expected a catchableSIGABRTexception is removed, and so ism_androidVersion, which only the old API-level check used.Results
Debug build on a Sony SO-01M (Android 11, arm64), V8, both trees. The app runs the benchmark worker;
kill -11orkill -6is sent to the app process.SIGSEGVDEBUGlines withsignal 11and a backtrace)JNI Exception occurredthrown from the handlerSIGABRT(kill -6), same four rowsSIGSEGVSIGSEGVWhat the next launch logged, in both trees:
The Jasmine suite on a debug build of this branch, same device:
triggers interval, a timing spec)The spec count is one lower because the disabled spec is removed. The suite ran on this branch with the PRs below it in the stack.
Not verified
kill, which exercises the re-raise path. A real fault that re-executes the faulting instruction (SEGV_MAPERR) and a crash while a module is loading were not induced, somodule=was<none>in every run above.SIGSEGVhandler for normal operation; the old code leftSIGSEGValone on JSC for that reason. This handler is installed first and chains to whatever was there before, so it should be safe, but it has not been run on JSC, Hermes, QuickJS or PrimJS.