New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 721071 link

Starred by 1 user

Issue metadata

Status: Unconfirmed
Owner: ----
Cc:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 3
Type: Task



Sign in to add a comment

Don't use System.exit() or atexit handlers on Android

Project Member Reported by bauerb@chromium.org, May 10 2017

Issue description

Under most circumstances, atexit handlers won't run on Android. The (only, to my knowledge) exception is a manual call to System.exit() because of some catastrophic failure. That can happen before any other shutdown has taken place though (including e.g. stopping message loops / background threads), which then leads to crashes in other, seemingly unrelated places (see e.g. issue 718166). If we want crashes, we should just throw an exception, which will at least give a more useful stack trace :)

So, we should:
1) Get rid of calls to System.exit(), replacing them with something that does proper cleanup (e.g. throwing an exception)
2) Make AtExitManager a no-op on Android, just to be on the safe side.

Thanks to Anthony for the investigation!
 

Comment 1 by torne@chromium.org, May 10 2017

Yeahhh we definitely shouldn't call System.exit(). The system doesn't ever consider this to be a crash/problem itself so it's not an appropriate way to exit even if it worked (though in practise we crash other places as you note).
See issue 718166 for an example of the confusion that can be caused by this. One thread called System.exit() causing other threads to crash. The actual reported crash is not from the thread that called System.exit(). The same System.exit() call also sometimes causes crashes in different places in the other threads. 
Friendly ping. Is there any update on this issue.
Labels: -Type-Bug Type-Task
No, but is this blocking anything?

Sign in to add a comment