Dmitry
Dmitry

Reputation: 2887

SIGBUS crash only on Samsung Galaxy S2

I've got a very strange problem - my works well on all devices, but occasionally crashes on Samsung Galaxy S2.

The app uses ffmpeg and crash is somewhere there. However, I can't see any problem in the code itself (if there was, it would crash on other devices as well).

I tried to compile with all asm-optimizations off, but still doesn't help.

It also seems that the crash happens only on 2.3.6 and doesn't crash on ICS.

*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I DEBUG   : Build fingerprint: '2.3.6/GINGERBREAD/LA2:user/release-keys'
I DEBUG   : pid: 28725, tid: 30055  >>> xxxxxxxxxxxxxx <<<
I DEBUG   : signal 7 (SIGBUS), code 128 (?), fault addr 00000000
I DEBUG   :  r0 8e25e9fe  r1 000000b1  r2 00877731  r3 00000000
I DEBUG   :  r4 5257fe78  r5 005a7300  r6 5257fec4  r7 00630340
I DEBUG   :  r8 00000000  r9 00000724  10 81de8c6c  fp 006ccfe8
I DEBUG   :  ip 81de44b4  sp 5257fe08  lr 819c3748  pc 818386a0  cpsr 28000010
I DEBUG   :  d0  fd794ba0fd619c90  d1  fd96d984fd94d4d0
I DEBUG   :  d2  fd9232c4fd8c7b34  d3  fdaf8694fda5c318
I DEBUG   :  d4  3f33c07d3f333e16  d5  3f34c43d3f34428b
I DEBUG   :  d6  40667a147ae147af  d7  bff0000000000000
I DEBUG   :  d8  3ee4f8b588e368f1  d9  4680000044a04000
I DEBUG   :  d10 43a18000446b8000  d11 0000000043a18000
I DEBUG   :  d12 0000000000000000  d13 0000000000000000
I DEBUG   :  d14 0000000000000000  d15 0000000000000000
I DEBUG   :  d16 0000000001e9a790  d17 fe4dfbc0fe7eccdc
I DEBUG   :  d18 fdd679ccfe11f78a  d19 fd6edbecfd9d4964
I DEBUG   :  d20 fe9afe9afea3fea3  d21 fe4dfe4dfe7efe7e
I DEBUG   :  d22 fdd6fdd6fe11fe11  d23 fd6efd6efd9dfd9d
I DEBUG   :  d24 fd79fd79fd61fd61  d25 fd96fd96fd94fd94
I DEBUG   :  d26 fd92fd92fd8cfd8c  d27 fdaffdaffda5fda5
I DEBUG   :  d28 3f3504f3bf3504f3  d29 bf3504f33f3504f3
I DEBUG   :  d30 4433681844aeb242  d31 3f3504f33f3504f3
I DEBUG   :  scr 2800009a
I DEBUG   : 
I DEBUG   :          #00  pc 000386a0  /data/data/xxxxxxx/lib/libffmpeg.so (av_packet_split_side_data)
I DEBUG   :          #01  lr 819c3748  /data/data/xxxxxxx/lib/libffmpeg.so
I DEBUG   : 
I DEBUG   : libc base address: afd00000
I DEBUG   : 
I DEBUG   : code around pc:
I DEBUG   : 81838680 0a000012 e5941014 e351000c da00000f 
I DEBUG   : 81838690 e2411008 e30e09fe e0822001 e3480e25 
I DEBUG   : 818386a0 e5928000 e5929004 e1a01008 e1a02009 
I DEBUG   : 818386b0 e6bf2f32 e1838002 e1a06003 e1580000 
I DEBUG   : 818386c0 e6bf1f31 e1a07001 e1a09001 0a000002 
I DEBUG   : 
I DEBUG   : code around lr:
I DEBUG   : 819c3728 e5933020 e3130020 1a000002 e5940014 
I DEBUG   : 819c3738 e3500000 0a00001c e1a00004 ebf9d3c4 
I DEBUG   : 819c3748 e595c078 e3a03000 e58d3004 e59c3020 
I DEBUG   : 819c3758 e3130901 1a000016 e58543a8 e1a00005 
I DEBUG   : 819c3768 e1a01007 e1a02006 e1a03004 e1a0e00f 
I DEBUG   : 
I DEBUG   : stack:
I DEBUG   :     5257fdc8  00000000  
I DEBUG   :     5257fdcc  00631ed8  
I DEBUG   :     5257fdd0  00001004  
I DEBUG   :     5257fdd4  00001000  
I DEBUG   :     5257fdd8  00000007  
I DEBUG   :     5257fddc  0080a788  
I DEBUG   :     5257fde0  000017bd  
I DEBUG   :     5257fde4  81f08477  /system/lib/libOpenSLES.so
I DEBUG   :     5257fde8  00632024  
I DEBUG   :     5257fdec  00000000  
I DEBUG   :     5257fdf0  05007ffc  
I DEBUG   :     5257fdf4  00000001  
I DEBUG   :     5257fdf8  00000018  
I DEBUG   :     5257fdfc  afd464ec  
I DEBUG   :     5257fe00  0026e7f1  
I DEBUG   :     5257fe04  00000000  
I DEBUG   : #00 5257fe08  0026f4f6  
I DEBUG   :     5257fe0c  afd13b69  /system/lib/libc.so
I DEBUG   :     5257fe10  5257fe78  
I DEBUG   :     5257fe14  005a7300  
I DEBUG   :     5257fe18  5257fec4  
I DEBUG   :     5257fe1c  00630340  
I DEBUG   :     5257fe20  00000000  
I DEBUG   :     5257fe24  00000724  
I DEBUG   :     5257fe28  81de8c6c  
I DEBUG   :     5257fe2c  819c3748  /data/data/xxxxxxxx/lib/libffmpeg.so
I DEBUG   :     5257fe30  0026f4f6  
I DEBUG   :     5257fe34  5257fe78  
I DEBUG   :     5257fe38  81de8c70  
I DEBUG   :     5257fe3c  5257fe78  
I DEBUG   :     5257fe40  81de8c70  
I DEBUG   :     5257fe44  81de4420  
I DEBUG   :     5257fe48  81de73c4  
I DEBUG   :     5257fe4c  00000000  
I DEBUG   : dumpstate /data/log/dumpstate_app_native.txt
I DEBUG   : debuggerd committing suicide to free the zombie!
I DEBUG   : debuggerd: Jan  5 2012 22:42:33

Has anybody seen anything strange with the device or that particular Android version? Or any suggestions where to look and how to fix?

Upvotes: 1

Views: 2858

Answers (2)

Andrei Buneyeu
Andrei Buneyeu

Reputation: 6680

I had very similar issue - ffmpeg caused crash of my app by signal 7 (SIGBUS) after decoding several hundreds of frames. It was not very device specific - on some devices app crashed more often, on other less often.

It was very incomprehensible issue for me cause it could happen at any time of video encoding/decoding and I couldn't find any conditions that causes failures. But I recompiled ffmpeg with -malign-double flag according to this useful article: http://software.intel.com/en-us/blogs/2011/08/18/understanding-x86-vs-arm-memory-alignment-on-android/. And it helped! So my full "configure" line is (of course not all of these flags are useful for you):

./configure --target-os=linux --cross-prefix=arm-linux-androideabi- --disable-asm --arch=arm --cpu=cortex-a9 --sysroot=${SYSROOT} --enable-neon --disable-avdevice --enable-decoder=mjpeg --enable-demuxer=mjpeg --enable-parser=mjpeg --enable-demuxer=image2 --enable-muxer=mp4 --prefix=build/armeabi-v7a --extra-cflags='-DANDROID -I${NDK_ROOT}/sources/cxx-stl/system/include -mtune=cortex-a9 -mfpu=neon -mfloat-abi=softfp' --extra-ldflags='-Wl,--fix-cortex-a8 -malign-double -L../android-libs -Wl,-rpath-link,../android-libs' --extra-cxxflags='-Wno-multichar -malign-double -fno-exceptions -fno-rtti'

Hope it'll help you.

Upvotes: 1

codetiger
codetiger

Reputation: 2779

This is actually a NULLPointerException and happens in your library ffmpeg. This line (pc 000386a0 /data/data/xxxxxxx/lib/libffmpeg.so) gives more information when you use the address (000386a0) to find the exact line of the problem.

You can use this commandline tool to find the function that give you the problem.

cd D:\ndk\toolchains\arm-linux-androideabi-4.4.3\prebuilt\windows\bin


arm-linux-androideabi-addr2line -C -f -e D:\work\ProjectDIR\libs\armeabi\libffmpeg.so

Upvotes: 0

Related Questions