I was wondering if anyone else has seen this; on my Milestone (running
2.1) I get a crash every so often deep in OpenGL code. I have to play
the game for several minutes to see it, and when it does happen the call
stack is worthless (pasted below).
If anyone has seen this before, please let me know, whether or not you
found the issue. I haven't tested other platforms yet (it takes a while
to reproduce regardless), and I'll dig for it brute force if necessary,
but considering it's so hard to repro I'm hoping for hints to save a bit
of time. :)
Tim
The log: (there's nothing interesting prior to this in the log from the
rendering thread at all -- just the standard messages printed by other
bits of my code at various times and in other threads)
06-14 20:52:29.391 I/DEBUG (19277): *** *** *** *** *** *** *** ***
*** *** *** *** *** *** *** ***
06-14 20:52:29.399 I/DEBUG (19277): Build fingerprint:
'MOTO_WIND/umts_sholes/umts_sholes/sholes:2.1-update1/SHOLS_U2_02.38.0/6904598:user/rel-keys'
06-14 20:52:29.399 I/DEBUG (19277): pid: 19463, tid: 19632 >>>
com.quickcharge.hamster.free <<<
06-14 20:52:29.399 I/DEBUG (19277): signal 11 (SIGSEGV), fault addr
4772b138
06-14 20:52:29.399 I/DEBUG (19277): r0 431ba3d4 r1 4772b138 r2
00000014 r3 0000000c
06-14 20:52:29.399 I/DEBUG (19277): r4 00a508c0 r5 00a51724 r6
00000002 r7 00000004
06-14 20:52:29.399 I/DEBUG (19277): r8 00000014 r9 00000001 10
00000004 fp 00000001
06-14 20:52:29.399 I/DEBUG (19277): ip 80000000 sp 47e46bb8 lr
81306a44 pc afe0df48 cpsr a8000050
06-14 20:52:30.188 I/DEBUG (19277): #00 pc 0000df48
/system/lib/libc.so
06-14 20:52:30.188 I/DEBUG (19277): #01 lr 81306a44
/system/lib/egl/libGLESv1_CM_POWERVR_SGX530_121.so
06-14 20:52:30.188 I/DEBUG (19277):
06-14 20:52:30.188 I/DEBUG (19277): code around pc:
06-14 20:52:30.188 I/DEBUG (19277): afe0df38 24c0c001 24c0e001
e1b0ce83 aa000001
06-14 20:52:30.188 I/DEBUG (19277): afe0df48 f4a1030d f480031d
3a000001 f421070d
06-14 20:52:30.188 I/DEBUG (19277): afe0df58 f400071d f5d1f000
f5d1f040 e2522040
06-14 20:52:30.188 I/DEBUG (19277):
06-14 20:52:30.188 I/DEBUG (19277): code around lr:
06-14 20:52:30.188 I/DEBUG (19277): 81306a34 e59c102c e59c2024
e1a0e00f e59cf034
06-14 20:52:30.188 I/DEBUG (19277): 81306a44 e2866001 e2855004
e5942eb0 e3a03001
06-14 20:52:30.188 I/DEBUG (19277): 81306a54 e1560002 3affffec
e2840d77 e1a01008
06-14 20:52:30.188 I/DEBUG (19277):
06-14 20:52:30.188 I/DEBUG (19277): stack:
06-14 20:52:30.188 I/DEBUG (19277): 47e46b78 00000000
06-14 20:52:30.188 I/DEBUG (19277): 47e46b7c 00000000
06-14 20:52:30.188 I/DEBUG (19277): 47e46b80 00000000
06-14 20:52:30.196 I/DEBUG (19277): 47e46b84 00a508c0 [heap]
06-14 20:52:30.196 I/DEBUG (19277): 47e46b88 eeeeeeef
06-14 20:52:30.196 I/DEBUG (19277): 47e46b8c 4772b138
06-14 20:52:30.196 I/DEBUG (19277): 47e46b90 0063b7c4 [heap]
06-14 20:52:30.196 I/DEBUG (19277): 47e46b94 00983078 [heap]
06-14 20:52:30.196 I/DEBUG (19277): 47e46b98 00000000
06-14 20:52:30.196 I/DEBUG (19277): 47e46b9c 00a508c0 [heap]
06-14 20:52:30.196 I/DEBUG (19277): 47e46ba0 00a5171c [heap]
06-14 20:52:30.196 I/DEBUG (19277): 47e46ba4 00000000
06-14 20:52:30.196 I/DEBUG (19277): 47e46ba8 00000004
06-14 20:52:30.196 I/DEBUG (19277): 47e46bac 00000014
06-14 20:52:30.196 I/DEBUG (19277): 47e46bb0 df002777
06-14 20:52:30.196 I/DEBUG (19277): 47e46bb4 e3a070ad
06-14 20:52:30.196 I/DEBUG (19277): #00 47e46bb8 431ba3d4 /dev/pvrsrvkm
06-14 20:52:30.196 I/DEBUG (19277): 47e46bbc 81306a44
/system/lib/egl/libGLESv1_CM_POWERVR_SGX530_121.so
06-14 20:52:30.196 I/DEBUG (19277): 47e46bc0 00a508c0 [heap]
06-14 20:52:30.196 I/DEBUG (19277): 47e46bc4 00000004
06-14 20:52:30.196 I/DEBUG (19277): 47e46bc8 00000004
06-14 20:52:30.196 I/DEBUG (19277): 47e46bcc 00000000
06-14 20:52:30.204 I/DEBUG (19277): 47e46bd0 00000006
06-14 20:52:30.204 I/DEBUG (19277): 47e46bd4 81308404
/system/lib/egl/libGLESv1_CM_POWERVR_SGX530_121.so
06-14 20:52:30.204 I/DEBUG (19277): 47e46bd8 00a508c0 [heap]
06-14 20:52:30.204 I/DEBUG (19277): 47e46bdc 8136a5e4
/system/lib/egl/libGLESv1_CM_POWERVR_SGX530_121.so
06-14 20:52:30.204 I/DEBUG (19277): 47e46be0 00000004
06-14 20:52:30.204 I/DEBUG (19277): 47e46be4 00000000
06-14 20:52:30.204 I/DEBUG (19277): 47e46be8 00000006
06-14 20:52:30.204 I/DEBUG (19277): 47e46bec 813098b0
/system/lib/egl/libGLESv1_CM_POWERVR_SGX530_121.so
06-14 20:52:30.204 I/DEBUG (19277): 47e46bf0 00000004
06-14 20:52:30.204 I/DEBUG (19277): 47e46bf4 00000000
06-14 20:52:30.204 I/DEBUG (19277): 47e46bf8 00000000
06-14 20:52:30.204 I/DEBUG (19277): 47e46bfc 00000000
06-14 20:52:32.391 D/dalvikvm( 1347): GC freed 6 objects / 208 bytes in
111ms
06-14 20:52:33.071 I/ActivityManager( 1283): Process
com.quickcharge.hamster.free (pid 19463) has died.
--
You received this message because you are subscribed to the Google Groups "android-ndk" group.
To post to this group, send email to andro...@googlegroups.com.
To unsubscribe from this group, send email to android-ndk...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/android-ndk?hl=en.
> 06-14 20:52:30.188 I/DEBUG (19277): #00 pc 0000df48
> /system/lib/libc.so
> 06-14 20:52:30.188 I/DEBUG (19277): #01 lr 81306a44
> /system/lib/egl/libGLESv1_CM_POWERVR_SGX530_121.so
Have you tried addr2line? Eg:
$ adb pull /system/lib/libc.so
$ adb pull /system/lib/egl/libGLESv1_CM_POWERVR_SGX530_121.so
$ arm-linux-androideabi-addr2line -f -e libc.so 0000df48
$ arm-linux-androideabi-addr2line -f -e libGLESv1_CM_POWERVR_SGX530_121.so 81306a44
--
Olivier
I hadn't, but sure, why not:
tim@Panther /c/Users/tim/projects/games/HamsterAttack
$
/f/Devel/android-ndk-r5c/toolchains/arm-linux-androideabi-4.4.3/prebuilt/windows/bin/arm-linux-androideabi-addr2line.exe
-f -e libc.so 0000df48
memcpy
??:0
tim@Panther /c/Users/tim/projects/games/HamsterAttack
$
/f/Devel/android-ndk-r5c/toolchains/arm-linux-androideabi-4.4.3/prebuilt/windows/bin/arm-linux-androideabi-addr2line.exe
arm-linux-androideabi-addr2line -f -e libGLESv1_CM_POWERVR_SGX530_121.so
81306a44
??
??:0
??
??:0
So it was in a memcpy(), but we can't tell much else. Could be that
Gregory was right and it ran out of memory, or it could be that there's
a threading bug where loading graphics at runtime can occasional barf.
In either case, if I preload my graphics, it will either crash less (if
the problem is threading) or immediately (if I'm running out of memory).
So I'll try preloading and see what happens. :)
If you have any other thoughts, though, let me know.
Tim
I now preallocate all of the textures I'm using (I'm pretty sure, at
least). If I were wrong, I should see a log message right before the
crash: Just before I load a texture into OpenGL, I print out its newly
allocated texture ID. So unless glGenTextures( 1, &texture ) is what's
crashing (and why would glGenTextures use the PVR subsystem?), it
doesn't appear to be that it's running out of memory. :(
I've added an extra log statement before glGenTextures "just in case",
but I doubt that's the issue. Doesn't cost me anything to add the log
statement, though.
Any other guesses? This time I had to play through 24 levels to get it
to crash, but the crash dump was basically the same as last time. :(
It could still be memory-related, though. About four seconds AFTER the
crash I saw this both times:
06-15 23:13:15.459: INFO/ActivityManager(1283): Low Memory: No more
background processes.
I used to see that before a lot more often -- until I killed a bad
memory leak. And it didn't seem to ever cause a crash then. At this
point I'm beginning to wonder if ANOTHER app is doing something that's
asking for RAM and causing this problem; playing through several levels
on Windows (where I can watch the RAM usage) shows it holding steady. I
can look at ways of reducing my overall footprint, though it's a
trade-off with user experience when I have to reload any textures I
discard after they're loaded. About a half second before the crash (this
time) I see "AudioHardwareMot -- AudioMgr:Output 0xb538 exiting
standby", but nothing else that seems related.
Thoughts? My next approach will be to reduce runtime memory usage, to
see if that helps, but if anyone has another thought I'm all ears.
Tim
Hey does your app use multithreading? If it does maybe you have a process that is just sitting there spinning it's wheels, eating memory? Are you clearing the video buffer at all or are the previous level textures just inadvertently not being purged?
Not much open gl experience but normal development frequently has memory issues.
while (1) { { qcMutexHold queueMutex(gSysData.queueMutex); if (queueToDraw!=gSysData.currentQueue) { gSysData.queueToDraw = queueToDraw; break; } } // release mutex, then sleep, then try again // bail if we've been deactivated if (!m_active) { return ; } usleep(800); }
{ qcMutexHold queueMutex(gSysData.queueMutex); gSysData.currentQueue ++; if (gSysData.currentQueue == qcSysData::kNumQueues) { gSysData.currentQueue = 0; } } // If we've gotten ahead of the draw loop, then block // here while we wait for the draw queue to advance.
while (gSysData.currentQueue == gSysData.queueToDraw) { // bail if we've been deactivated if (!m_active) { return ; } usleep(400); }
Are there any docs anywhere on how to make it work, on the emulator or
otherwise?
Tim
I'd say that both stacktrace (only two calls with start point in opengl implementation?) and address 0x81306a44 looks suspicious and by suspicious I mean invalid :). So most plausible hypothesis are: invalid buffer access on stack variable ending in stack corruption, call through pointer with invalid pointer (much less likely since usually it will leave some traces, 'random' memory corruption ie. in some place due to bug you are writing to 'random' address.