120

Currently, we are experiencing a DeadSystemException in our HockeyApp crash reporting. It occurs on Android 7.0 and Android 7.1. We don't experience this exception in the previous version of our application (they are currently both used by users), so I guess this exception is caused by some code change. But stack trace is not very helpful for this. Any idea? Thanks for any suggestions.

Stack trace from HockeyApp:

java.lang.RuntimeException: android.os.DeadSystemException
at android.app.ActivityThread$StopInfo.run(ActivityThread.java:3781)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:154)
at android.app.ActivityThread.main(ActivityThread.java:6119)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:886)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:776)
Caused by: android.os.DeadSystemException
... 8 more
ataravati
  • 8,891
  • 9
  • 57
  • 89
convexHull
  • 1,761
  • 2
  • 15
  • 18
  • 1
    Please post the code & mention the line of code where exception occurs. – Aishwarya Tiwari Mar 14 '17 at 11:42
  • 4
    i would say it's not your app's problem, as in docs : `The core Android system has died and is going through a runtime restart. All running apps will be promptly killed.` this mostly happens somewhere else and affect your app ? – Yazan Mar 14 '17 at 12:22
  • 2
    @AishwaryaTiwari I'm not able to reproduce the bug locally - so I'm not able to post any piece of code. All I have is the stack trace from HockeyApp – convexHull Mar 14 '17 at 12:48
  • 1
    It's an exception thrown by the Android Framework, I'm sorry I can't help you with this. – Aishwarya Tiwari Mar 14 '17 at 13:40
  • @Yazan I would say the same.. But currently we have 2 versions of our application in production (lets say 1.1 and 1.2) with the same crash reporting (HockeyApp) 1.1 `DeadSystemException` isn't contained in crash report 1.2 `DeadSystemException` are there... – convexHull Mar 14 '17 at 15:43
  • Hey, I'm having the same problem when calling getLaunchIntentForPackage() from PackageManager, the user says it's crashing. – dasfima Mar 20 '17 at 12:01
  • I've consolidated the comments above, and the results of my investigation into a Community Wiki answer [below](https://stackoverflow.com/a/44395215/383414) - meaning anyone should feel free to add to this as more info is found. – Richard Le Mesurier Jun 06 '17 at 16:25
  • @AishwaryaTiwari : Exception occurs only in specific devices not in all and its random exception – Anand Savjani Jun 13 '18 at 17:36
  • How are the statistics of the crash, like how many times had it occurred and how many users are facing the issue? If it is seldom one we might ignore it – Ismail Iqbal May 22 '19 at 18:09
  • 1
    I'm interested to see if anyone has been able to reproduce the crash. The repro' steps will be awarded the bounty – David Rawson May 24 '19 at 00:36
  • I am having this issue as well, this time happening when one of my activity is resuming. – Neon Warge May 03 '21 at 09:14
  • I have the same exception on Android 9 – Vahe Gharibyan Dec 08 '22 at 07:24

5 Answers5

95

The Android Developer docs for android.os.DeadSystemException says the following:

The core Android system has died and is going through a runtime restart. All running apps will be promptly killed.

The source code does not help much more:

package android.os;
/**
 * The core Android system has died and is going through a runtime restart. All
 * running apps will be promptly killed.
 */
public class DeadSystemException extends DeadObjectException {
    public DeadSystemException() {
        super();
    }
}

Overall, it looks like this is being thrown by the OS and has nothing to do with our code.

Looking at the JavaDoc from the superclass, DeadObjectException, backs this theory up:

The object you are calling has died because its hosting process no longer exists.

Moustafa EL-Saghier
  • 1,721
  • 1
  • 13
  • 43
Richard Le Mesurier
  • 29,432
  • 22
  • 140
  • 255
41

One cause was a bug in the notification service of Android version 7 and 8.

It was caused by using "vibration pattern" in the notifications, which throws an ArrayOutOfBoundsException. This leads the whole system to crash and post a DeadSystemException.

For further details you can refer to this Medium article here.

David Rawson
  • 20,912
  • 7
  • 88
  • 124
Vanshaj Daga
  • 2,145
  • 11
  • 18
  • Lockout reporting confirms you – Trk Oct 11 '19 at 16:41
  • 26
    I don't buy it. I see many reports of this exception in App Center, and all are with Android 10, not Android 7 or 8. – Justin Feb 04 '20 at 16:41
  • 2
    I concur with Justin, I am seeing a lot of these issues popping up with devices running Android API 29, and we are not using the vibration option on the notification channels. – Hrafn Aug 28 '20 at 09:55
  • @Justin did you find anything work around or something ! – hio Jan 13 '21 at 09:29
  • I also got this exception on Android 7. – CoolMind Feb 08 '21 at 08:35
  • i got it on android 12 – Moustafa EL-Saghier Nov 10 '22 at 12:15
  • Our App has DataDog for Logging and devices from all OS versions are reported to have faced this error. For us this is happening with single SDK; Moengage. Seeing this message I think Notification may have one of the many roles to play in our case. As that SDK is made for targeting users with campaigns and notifications based on events. But I am not certain, nor is Moengage team's developers. – sud007 Nov 17 '22 at 09:52
  • This answer is BS. This is the whole concept of OS - not to allow one crappy app to crash "the whole system". – Marian Paździoch May 30 '23 at 07:58
25
Fatal Exception: java.lang.RuntimeException: android.os.DeadSystemException

This exception was caused in one of the apps I was developing, it occurred mostly in MI devices.

After debugging I found that I was trying to start another service (Say B) in the current service (Say A) from a background thread, but when startService(itService) method was called the service A was already killed.

The only solution I found till now is to check if the current service A is running or not before you start another service B. Depending on your implementation you can use one of the various ways to check if a services is running from this answer.

Shantanu
  • 1,190
  • 1
  • 13
  • 23
1

I was able to reproduce this exception in one of my apps.

It turns out that I misunderstood something while implementing in-app purchases, as I wasn't expecting Google to notify also the already purchased and acknowledged products, so I was not checking if I already managed the purchased product notified about.

So I had an infinite loop in my app consisting on reloading again and again and again the same information on screen, until eventually (but a little bit randomly I must say) this exception raises.

Caused by java.lang.RuntimeException
android.os.DeadSystemException
    android.app.ApplicationPackageManager.getPackageInfoAsUser (ApplicationPackageManager.java:188)
    android.app.ApplicationPackageManager.getPackageInfo (ApplicationPackageManager.java:159)
    com.google.android.gms.common.GooglePlayServicesUtilLight.isGooglePlayServicesAvailable (GooglePlayServicesUtilLight.java:13)
    com.google.android.gms.common.GoogleApiAvailabilityLight.isGooglePlayServicesAvailable (GoogleApiAvailabilityLight.java:2)

I hope this to be useful to someone, as it's info about how to try to reproduce the exception, not how to solve it (well, in my case was just fixing the silly error and preventing the infinite loop of screen reloading, but there must be variety of different causes producing this exception).

YawaraNes
  • 121
  • 2
  • 7
0

Another example :

try {
     ActivityManager.getMyMemoryState(mAppProcessInfo);
} catch (Exception exception) {
     exception.printStackTrace();
     return;
}
Viktor Jovanovski
  • 1,513
  • 10
  • 26
Rubin
  • 1