java - thread exiting with uncaught exception: NO stack trace -


my application causing force close somewhere instead of getting fatal exception usual (and informative) stack trace in logcat, receive following 4 lines:

06-27 07:08:54.546: d/dalvikvm(14351): gc_for_malloc freed 9923 objects / 657416 bytes in 21ms 06-27 07:08:54.769: w/dalvikvm(14351): threadid=20: thread exiting uncaught exception (group=0x4001d7f0) 06-27 07:08:54.796: w/dalvikvm(14351): threadid=21: thread exiting uncaught exception (group=0x4001d7f0) 06-27 07:08:54.796: i/process(14351): sending signal. pid: 14351 sig: 9 

this in debug mode no filters applied on logcat!

  • what causing behavior?
  • is there way tell what's causing exception?

update: @assylias below, i've been able implement:

final uncaughtexceptionhandler subclass = thread.currentthread().getuncaughtexceptionhandler(); thread.setdefaultuncaughtexceptionhandler(new thread.uncaughtexceptionhandler() {     @override     public void uncaughtexception(thread paramthread, throwable paramthrowable) {     log.getstacktracestring(paramthrowable);      subclass.uncaughtexception(paramthread, paramthrowable);     } }); 

which produced these added lines:

06-27 08:24:47.105: d/dalvikvm(15475): gc_for_malloc freed 13865 objects / 1435952 bytes in 45ms 06-27 08:24:47.136: i/dalvikvm(15475): threadid=15: stack overflow on call ljava/lang/abstractstringbuilder;.enlargebuffer:vi 06-27 08:24:47.136: i/dalvikvm(15475):   method requires 28+20+20=68 bytes, fp 0x45209338 (56 left) 06-27 08:24:47.140: i/dalvikvm(15475):   expanding stack end (0x45209300 0x45209000) 06-27 08:24:47.140: i/dalvikvm(15475): shrank stack (to 0x45209300, curframe 0x4520937c) 06-27 08:24:47.159: i/dalvikvm(15475): threadid=16: stack overflow on call ljava/lang/abstractstringbuilder;.enlargebuffer:vi 06-27 08:24:47.159: i/dalvikvm(15475):   method requires 28+20+20=68 bytes, fp 0x4520c338 (56 left) 06-27 08:24:47.167: i/dalvikvm(15475):   expanding stack end (0x4520c300 0x4520c000) 06-27 08:24:47.167: i/dalvikvm(15475): shrank stack (to 0x4520c300, curframe 0x4520c37c) 06-27 08:24:47.175: i/dalvikvm(15475): threadid=17: stack overflow on call ljava/lang/abstractstringbuilder;.enlargebuffer:vi 06-27 08:24:47.175: i/dalvikvm(15475):   method requires 28+20+20=68 bytes, fp 0x4520f338 (56 left) 06-27 08:24:47.175: i/dalvikvm(15475):   expanding stack end (0x4520f300 0x4520f000) 06-27 08:24:47.175: i/dalvikvm(15475): shrank stack (to 0x4520f300, curframe 0x4520f37c) 

this more useful information, i'm struggling following:

  • the application doesn't force-close now, despite call subclass.uncaughtexception(). why?
  • what meaning of stack overflows? doing that's taxing on poor android test device?
  • how can tell part in code causes this?

update: log.getstacktracestring(paramthrowable); wasn't printing anything. print received bogus subclass.uncaughtexception(paramthread, paramthrowable); right way of logging full stack trace using log.e(tag, "uncaughtexception", throwable).

the question remaining how re-throw exception? throw paramthrowable?

answering last question: eclipse won't let me throw without surrounding try/catch, led me understand want not re-throw killprocess(). problem solved.

you set default uncaught exception handler @ beginning of app , log data in there (example below using java logger easy transpose android):

private static void setdefaultuncaughtexceptionhandler() {     try {         thread.setdefaultuncaughtexceptionhandler(new thread.uncaughtexceptionhandler() {              @override             public void uncaughtexception(thread t, throwable e) {                 logger.error("uncaught exception detected in thread {}", t, e);             }         });     } catch (securityexception e) {         logger.error("could not set default uncaught exception handler", e);     } } 

Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -