Why does android logcat not show the stack trace for a runtime exception?

Jackson Kulik

An android application that I am currently developing was crashing (fixed that), due to what should have raised an IndexOutOfBoundsException. I was accessing a string in the doInBackground method of a class that extends AyncTask, from the variable arguments parameter (ie String...). I was accidentally accessing index 1 (not 0) of a one element variable argument string (mildly embarrassing...). When the application first crashed I looked at my logcat, (and many times again to confirm that I wasn't insane) and there was no stack trace for a RuntimeException to be found. I crash my phone quite often and there is always a nice little stack trace for me to look at and fix with, but I was puzzled by this. Here is the pertinent section of my logcat (which contains no stack trace for a runtimeexception), following a debug statement right before the line of code that was causing the crash:

W/dalvikvm(25643): threadid=11: thread exiting with uncaught exception (group=0x40c281f8)
D/dalvikvm(25643): GC_CONCURRENT freed 1249K, 25% free 12433K/16455K, paused 2ms+6ms
W/dalvikvm(25643): threadid=15: thread exiting with uncaught exception (group=0x40c281f8)
I/Process (25643): Sending signal. PID: 25643 SIG: 9
I/ActivityManager( 5905): Process com.trade.nav.ges (pid 25643) has died.
W/ActivityManager( 5905): Force removing r: app died, no saved state
I/WindowManager( 5905): WIN DEATH: win
I/WindowManager( 5905): WIN DEATH: win
I/SurfaceFlinger( 1746): id=3848 Removed idx=2 Map Size=4
I/SurfaceFlinger( 1746): id=3848 Removed idx=-2 Map Size=4
I/WindowManager( 5905): WIN DEATH: win
I/power   ( 5905): *** acquire_dvfs_lock : lockType : 1  freq : 1000000 
D/PowerManagerService( 5905): acquireDVFSLockLocked : type : DVFS_MIN_LIMIT  frequency :  1000000  uid : 1000  pid : 5905  tag : ActivityManager
W/ActivityManager( 5905): mDVFSLock.acquire()

And after that, another activity starts. For reference, here is the code that caused the crash:

private class LoadImage extends AsyncTask<String, Integer, Bitmap> {
    String url = "";
    //...
    public LoadImage(ImageView iv, Context c) {
        //...
    }

    protected Bitmap doInBackground(String... urls) {
        // urls has one element
        url = urls[1];
        //...
    }
    //...
}

Any insight into what is happening would please me greatly, as I am curious about having never seen anything like this on the internet. Thanks.

Edit: I have no filter set

fadden

Your threads are clearly crashing (note the thread exiting with uncaught exception on two different threads in the same process). The process is cleaning up after itself -- Sending signal indicates the process is sending a fatal signal to itself. So the question is why you aren't seeing a stack dump between these two.

The stack dump comes from RuntimeInit$UncaughtHandler, which is the framework-provided global uncaught exception handler. The process self-annihilation happens in the finally block. It's hard to see a way to get out of this without logging "FATAL EXCEPTION", unless something in Slog.e fails and throws.

I would guess that either something is failing in Slog.e, or somebody has replaced the framework's uncaught exception handler. The latter could happen if you've incorporated some external library into your app, such as a crash log catcher or an ad network, and the new handler doesn't log the exception but does kill the process.

You can track it down by attaching a Java-language debugger (e.g. Eclipse). By default it will stop on uncaught exceptions. From there you can trace it around, set breakpoints and single-step through the uncaught exception handler (if you have full sources), and so on.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

How to print the stack trace of an exception object in Python?

From Dev

locals() and globals() in stack trace on exception (Python)

From Dev

Rethrow an Exception with correct line numbers in the stack trace

From Dev

How can an Exception be created/thrown with no stack trace?

From Dev

Behat with PhpStorm does not show stack trace for exceptions

From Dev

Exception Stack Trace Missing Items

From Dev

Android Studio Logcat Filter does not show up

From Dev

Why is the exception stack trace not logged in?

From Dev

How to use a stack trace dump to debug an exception?

From Dev

Why does catch in a method handling an Action truncate the stack trace?

From Dev

logback: newline before exception stack trace but not otherwise?

From Dev

Suppressing stack trace when catching exception

From Dev

Why does LLDB refer to the top of the stack trace as the bottom?

From Dev

Does re-throwing an exception in PHP destroy the stack trace?

From Dev

Exception that emails stack trace when raised

From Dev

Android phone not dumping stack trace

From Dev

defer.reject() in protractor does not show the stack trace? That is, I don't know which line of the code

From Dev

Exception stack trace and aggregation in Parallel.ForEach

From Dev

Android Studio Stack Trace Error

From Dev

Why does this exception not cause a runtime error?

From Dev

How to print the stack trace of an exception object in Python?

From Dev

locals() and globals() in stack trace on exception (Python)

From Dev

How to use a stack trace dump to debug an exception?

From Dev

cxf null pointer exception without stack trace

From Dev

Printing the stack trace vs the exception itself

From Dev

How does the console obtain the stack trace of an exception?

From Dev

Why does handleEvent() method throw a runtime exception?

From Dev

Android phone not dumping stack trace

From Dev

Android Logcat: Why does logging come through in bursts?

Related Related

  1. 1

    How to print the stack trace of an exception object in Python?

  2. 2

    locals() and globals() in stack trace on exception (Python)

  3. 3

    Rethrow an Exception with correct line numbers in the stack trace

  4. 4

    How can an Exception be created/thrown with no stack trace?

  5. 5

    Behat with PhpStorm does not show stack trace for exceptions

  6. 6

    Exception Stack Trace Missing Items

  7. 7

    Android Studio Logcat Filter does not show up

  8. 8

    Why is the exception stack trace not logged in?

  9. 9

    How to use a stack trace dump to debug an exception?

  10. 10

    Why does catch in a method handling an Action truncate the stack trace?

  11. 11

    logback: newline before exception stack trace but not otherwise?

  12. 12

    Suppressing stack trace when catching exception

  13. 13

    Why does LLDB refer to the top of the stack trace as the bottom?

  14. 14

    Does re-throwing an exception in PHP destroy the stack trace?

  15. 15

    Exception that emails stack trace when raised

  16. 16

    Android phone not dumping stack trace

  17. 17

    defer.reject() in protractor does not show the stack trace? That is, I don't know which line of the code

  18. 18

    Exception stack trace and aggregation in Parallel.ForEach

  19. 19

    Android Studio Stack Trace Error

  20. 20

    Why does this exception not cause a runtime error?

  21. 21

    How to print the stack trace of an exception object in Python?

  22. 22

    locals() and globals() in stack trace on exception (Python)

  23. 23

    How to use a stack trace dump to debug an exception?

  24. 24

    cxf null pointer exception without stack trace

  25. 25

    Printing the stack trace vs the exception itself

  26. 26

    How does the console obtain the stack trace of an exception?

  27. 27

    Why does handleEvent() method throw a runtime exception?

  28. 28

    Android phone not dumping stack trace

  29. 29

    Android Logcat: Why does logging come through in bursts?

HotTag

Archive