Binder: Be forceful about a forceful exit.
We were previously using exit(1) when code servicing an IPC threw any subclass of Error. That made it much harder to diagnose cases where that happened because : - exit runs global destructors, which might prove problematic (see linked bug). - such exits are often due to bugs in application code (things like AssertionErrors being thrown) but aren't flagged as such by our infrastructure, or by humans for that matter. To address both issues, use FatalError() so that the runtime can dump more useful information to the logs before it aborts. Test: manual Bug: 36813403 Change-Id: I5826090229109dc7cb19f0c3571c609f990cd36a
This commit is contained in:
@@ -192,18 +192,12 @@ static void report_exception(JNIEnv* env, jthrowable excep, const char* msg)
|
|||||||
|
|
||||||
if (env->IsInstanceOf(excep, gErrorOffsets.mClass)) {
|
if (env->IsInstanceOf(excep, gErrorOffsets.mClass)) {
|
||||||
/*
|
/*
|
||||||
* It's an Error: Reraise the exception, detach this thread, and
|
* It's an Error: Reraise the exception and ask the runtime to abort.
|
||||||
* wait for the fireworks. Die even more blatantly after a minute
|
* This will dump the pending exception as well as all thread traces
|
||||||
* if the gentler attempt doesn't do the trick.
|
* to the log.
|
||||||
*
|
|
||||||
* The GetJavaVM function isn't on the "approved" list of JNI calls
|
|
||||||
* that can be made while an exception is pending, so we want to
|
|
||||||
* get the VM ptr, throw the exception, and then detach the thread.
|
|
||||||
*/
|
*/
|
||||||
env->Throw(excep);
|
env->Throw(excep);
|
||||||
env->ExceptionDescribe();
|
env->FatalError("java.lang.Error thrown during binder transaction.");
|
||||||
ALOGE("Forcefully exiting");
|
|
||||||
exit(1);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bail:
|
bail:
|
||||||
|
|||||||
Reference in New Issue
Block a user