13

I recently received complaint from a user that my app was crashing. I've extracted the following from the user's error logs and was able to see why issues where happening:

12-17 10:31:12.446 I/PLAYLIST( 3158): PreparePlaylist
12-17 10:31:12.446 I/PLAYLIST( 3158): URL: http://f69cbd7a-3d91-4bf5-b4c6-ddb1175cf9e9.d40f2093-2013-4ad9-aec2-e99b015d61ca.070305e7-a706-4626-9ecb-777835065841.groovera.com/listen.pls
12-17 10:31:12.456 F/unknown ( 3158): stack corruption detected: aborted
12-17 10:31:12.466 D/Zygote  ( 2204): Process 3158 terminated by signal (6)
12-17 10:31:12.471 I/ActivityManager( 2256): Process com.android.Player:remote (pid 3158) has died.

There was a stack corruption detected. Great, so how do I find out why that's happening?

I think the issue is happening at this particular class since I was expecting more log output from it before it died. This class uses sockets to download playlist and parse it. How could I be corrupting the stack? I have dealt with stack overflows in C/C++, but how do I handle it in Java?

Thanks for your help!

Paul Lammertsma
  • 37,593
  • 16
  • 136
  • 187
Jona
  • 13,325
  • 15
  • 86
  • 129
  • If your code is reading URLs, here is [some recommendation](http://comments.gmane.org/gmane.comp.handhelds.android.devel/91510). – khachik Dec 17 '10 at 16:34
  • that host name looks pretty long – bigstones Dec 17 '10 at 16:54
  • 1
    It's well under the 253-character limit for FQDNs. – Blrfl Dec 17 '10 at 17:04
  • Yeah the url is long but it does seem to be under the limit... I just can't reproduce the issue even with the same url... I guess understanding what are the typical cases why a stack overflow in java would happen could help resolve the issue... About the URL connecting recommendation I"m already using those methods :) – Jona Dec 17 '10 at 18:57
  • Looks like a bug in the JVM to me. I can't imagine any bytecode actually corrupting stack. There are no pointers in Java to corrupt the stack, and there is the StackOverflowException for stack overflow. – Sergei Tachenov Dec 17 '10 at 19:44

1 Answers1

12

The message indicates corruption of the native stack. Code to detect stack buffer overflows is inserted when the gcc flag "-fstack-protector" is used.

If your app doesn't have any JNI code, then this could very well be a bug in the Android platform.

If you have a way to reproduce this, please file a bug on b.android.com with the details.

fadden
  • 51,356
  • 5
  • 116
  • 166
  • Thanks! Yeah there is no JNI code. Pure java... The problem is I can't reproduce it but a user of my app can every time so it seems... – Jona Dec 19 '10 at 20:47