0

I've created backup script which is copying files using cp adb shell command. After days of testing i am really confused because sometimes program crashed and i just dont know why. What should i do to avoid this problem?

I refresh my custom BaseAdapter every time when the copy finished. I dont think it is draw view problem after using notifyDataSetChanged() or meybe? Below my LogCat output.

When loop is executing command after command i got a lot of green (INFO/DEBUG) information then my program crash...

...
DEBUG/exec  cp /data/app/org.apache.android.media-1.apk /mnt/sdcard/allbackup/backup/2012-08-09_18@51@47!63/apps/org.apache.android.media.apk
DEBUG/exec  cp /data/app/com.cyrilmottier.android.listviewtipsandtricks-1.apk /mnt/sdcard/allbackup/backup/2012-08-09_18@51@47!63/apps/com.cyrilmottier.android.listviewtipsandtricks.apk
DEBUG/exec  cp /data/app/org.alexis.littre-1.apk /mnt/sdcard/allbackup/backup/2012-08-09_18@51@47!63/apps/org.alexis.littre.apk
DEBUG/exec  cp /data/app/jp.susatthi.ManifestViewer-1.apk /mnt/sdcard/allbackup/backup/2012-08-09_18@51@47!63/apps/jp.susatthi.ManifestViewer.apk
DEBUG/exec  cp /data/app/com.mxtech.videoplayer.ad-1.apk /mnt/sdcard/allbackup/backup/2012-08-09_18@51@47!63/apps/com.mxtech.videoplayer.ad.apk
DEBUG/exec  cp /data/app/com.rerware.android.MyBackupRoot-1.apk /mnt/sdcard/allbackup/backup/2012-08-09_18@51@47!63/apps/com.rerware.android.MyBackupRoot.apk
INFO/DEBUG  *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
INFO/DEBUG  Build fingerprint: 'samsung/GT-I9000/GT-I9000/GT-I9000:2.2/FROYO/XWJPH:user/release-keys'
INFO/DEBUG  pid: 8761, tid: 8761  >>> pl.backup <<<
INFO/DEBUG  signal 11 (SIGSEGV), fault addr 00001fd8
INFO/DEBUG   r0 00000035  r1 482347e0  r2 003fbf80  r3 4003fbf8
INFO/DEBUG   r4 007f7f00  r5 00001fa0  r6 bef5a240  r7 00001f84
INFO/DEBUG   r8 00000000  r9 000001fb  10 4003fbf8  fp 4818e7b8
INFO/DEBUG   ip 4b58caa7  sp bef5a1f8  lr 4b58ccdb  pc 4b58c690  cpsr 28000030
INFO/DEBUG   d0  6472656767756265  d1  0000005a41400000
INFO/DEBUG   d2  0000003c00000003  d3  0044abb800000001
INFO/DEBUG   d4  0000000000000000  d5  0000000000000000
INFO/DEBUG   d6  0000000100000001  d7  408000003f800000
INFO/DEBUG   d8  4194000041900000  d9  3ff0000000000012
INFO/DEBUG   d10 3ff0000000000000  d11 0000000000000000
INFO/DEBUG   d12 0000000000000000  d13 0000000000000000
INFO/DEBUG   d14 0000000000000000  d15 0000000000000000
INFO/DEBUG   d16 0000000700000000  d17 c053000000000000
INFO/DEBUG   d18 0000000000000000  d19 0000000000000000
INFO/DEBUG   d20 3ff0000000000000  d21 8000000000000000
INFO/DEBUG   d22 0000000000000000  d23 0006000300070002
INFO/DEBUG   d24 0101010101010101  d25 0000000000000000
INFO/DEBUG   d26 0016001600170016  d27 0016001600170016
INFO/DEBUG   d28 002f002e002f002e  d29 3ff0000000000000
INFO/DEBUG   d30 0000000000000000  d31 3ff0000000000000
INFO/DEBUG   scr 60000012
DEBUG/exec  cp /data/app/com.androidemu.n64-1.apk /mnt/sdcard/allbackup/backup/2012-08-09_18@51@47!63/apps/com.androidemu.n64.apk
DEBUG/exec  cp /data/app/com.androidemu.nes-1.apk /mnt/sdcard/allbackup/backup/2012-08-09_18@51@47!63/apps/com.androidemu.nes.apk
INFO/DEBUG           #00  pc 4b58c690  /dev/ashmem/dalvik-jit-code-cache (deleted)
INFO/DEBUG           #01  lr 4b58ccdb  /dev/ashmem/dalvik-jit-code-cache (deleted)
INFO/DEBUG  code around pc:
INFO/DEBUG  4b58c670 01000100 00280000 4321c584 01020018 
INFO/DEBUG  4b58c680 43dcdd1a 49190054 f2a568b0 2800071c 
INFO/DEBUG  4b58c690 63e963a8 c703d010 a1094c13 f7aea20a 
INFO/DEBUG  4b58c6a0 e011ed78 f8d7e008 290000ec 6ef7dc01 
INFO/DEBUG  4b58c6b0 a10347b8 ecf2f7ae 6df1480b 1c2d4788 
INFO/DEBUG  code around lr:
INFO/DEBUG  4b58ccb8 1c0800cc 1c116029 071cf2a5 606a2800 
INFO/DEBUG  4b58ccc8 c703d010 a1094c13 f7aea20a e011ea5e 
INFO/DEBUG  4b58ccd8 f8d7e008 29000698 6ef7dc01 a10347b8 
INFO/DEBUG  4b58cce8 e9d8f7ae 6df1480b 1c2d4788 4300e047 
INFO/DEBUG  4b58ccf8 43cecc74 0000e7fe 00000000 00000000 
INFO/DEBUG  stack:
INFO/DEBUG      bef5a1b8  40020e00  /dev/ashmem/mspace/dalvik-heap/zygote/0 (deleted)
INFO/DEBUG      bef5a1bc  80945327  /system/lib/libdvm.so
INFO/DEBUG      bef5a1c0  430cb368  
INFO/DEBUG      bef5a1c4  440990a5  /system/framework/framework.odex
INFO/DEBUG      bef5a1c8  00000000  
INFO/DEBUG      bef5a1cc  8094d7c7  /system/lib/libdvm.so
INFO/DEBUG      bef5a1d0  809a23f4  /system/lib/libdvm.so
INFO/DEBUG      bef5a1d4  00000001  
INFO/DEBUG      bef5a1d8  00000001  
INFO/DEBUG      bef5a1dc  00000008  
INFO/DEBUG      bef5a1e0  430cb304  
INFO/DEBUG      bef5a1e4  43d3e79a  /system/framework/framework.odex
INFO/DEBUG      bef5a1e8  43cece82  /system/framework/framework.odex
INFO/DEBUG      bef5a1ec  80973339  /system/lib/libdvm.so
INFO/DEBUG      bef5a1f0  df002777  
INFO/DEBUG      bef5a1f4  e3a070ad  
INFO/DEBUG  #00 bef5a1f8  438bc000  /system/framework/core.odex
INFO/DEBUG      bef5a1fc  bef5a240  [stack]
INFO/DEBUG      bef5a200  0028cb90  [heap]
INFO/DEBUG      bef5a204  0000cd38  [heap]
INFO/DEBUG      bef5a208  000361b0  [heap]
INFO/DEBUG      bef5a20c  000003a0  
INFO/DEBUG      bef5a210  809a22e0  /system/lib/libdvm.so
INFO/DEBUG      bef5a214  809a6ee0  /system/lib/libdvm.so
INFO/DEBUG      bef5a218  bef5a4e8  [stack]
INFO/DEBUG      bef5a21c  80922798  /system/lib/libdvm.so
INFO/DEBUG      bef5a220  0000cd30  [heap]
INFO/DEBUG      bef5a224  bef5a240  [stack]
INFO/DEBUG      bef5a228  8092271c  /system/lib/libdvm.so
INFO/DEBUG      bef5a22c  00000000  
INFO/DEBUG      bef5a230  000003a0  
INFO/DEBUG      bef5a234  80921638  /system/lib/libdvm.so
INFO/DEBUG      bef5a238  bef5a3ac  [stack]
INFO/DEBUG      bef5a23c  bef5a3ac  [stack]
DEBUG/exec  cp /data/app/com.opera.browser-1.apk /mnt/sdcard/allbackup/backup/2012-08-09_18@51@47!63/apps/com.opera.browser.apk
INFO/DEBUG  dumpmesg > /data/log/dumpstate_app_native.log
INFO/BootReceiver   Copying /data/tombstones/tombstone_00 to DropBox (SYSTEM_TOMBSTONE)
INFO/dumpstate  begin
DEBUG/dalvikvm  GC_FOR_MALLOC freed 15878 objects / 1113800 bytes in 802ms
INFO/dalvikvm   threadid=3: reacting to signal 3
INFO/dalvikvm   threadid=3: reacting to signal 3
INFO/dalvikvm   Wrote stack traces to '/data/anr/traces.txt'
INFO/dalvikvm   threadid=3: reacting to signal 3
INFO/dalvikvm   Wrote stack traces to '/data/anr/traces.txt'
INFO/dalvikvm   Wrote stack traces to '/data/anr/traces.txt'
INFO/dalvikvm   threadid=3: reacting to signal 3
INFO/dalvikvm   threadid=3: reacting to signal 3
INFO/dalvikvm   threadid=3: reacting to signal 3
INFO/dalvikvm   Wrote stack traces to '/data/anr/traces.txt'
INFO/dalvikvm   threadid=3: reacting to signal 3
INFO/dalvikvm   Wrote stack traces to '/data/anr/traces.txt'
INFO/dalvikvm   Wrote stack traces to '/data/anr/traces.txt'
INFO/dalvikvm   threadid=3: reacting to signal 3
INFO/dalvikvm   threadid=3: reacting to signal 3
INFO/dalvikvm   threadid=3: reacting to signal 3
INFO/dalvikvm   Wrote stack traces to '/data/anr/traces.txt'
INFO/dalvikvm   Wrote stack traces to '/data/anr/traces.txt'
INFO/dalvikvm   threadid=3: reacting to signal 3
INFO/dalvikvm   Wrote stack traces to '/data/anr/traces.txt'
INFO/dalvikvm   threadid=3: reacting to signal 3
INFO/dalvikvm   threadid=3: reacting to signal 3
INFO/dalvikvm   threadid=3: reacting to signal 3
INFO/dalvikvm   Wrote stack traces to '/data/anr/traces.txt'
INFO/dalvikvm   Wrote stack traces to '/data/anr/traces.txt'
INFO/dalvikvm   Wrote stack traces to '/data/anr/traces.txt'
INFO/dalvikvm   threadid=3: reacting to signal 3
INFO/dalvikvm   Wrote stack traces to '/data/anr/traces.txt'
INFO/dalvikvm   threadid=3: reacting to signal 3
INFO/dalvikvm   threadid=3: reacting to signal 3
INFO/dalvikvm   Wrote stack traces to '/data/anr/traces.txt'
INFO/dalvikvm   threadid=3: reacting to signal 3
INFO/dalvikvm   threadid=3: reacting to signal 3
INFO/dalvikvm   threadid=3: reacting to signal 3
INFO/dalvikvm   threadid=3: reacting to signal 3
INFO/dalvikvm   threadid=3: reacting to signal 3
INFO/dalvikvm   threadid=3: reacting to signal 3
INFO/dalvikvm   threadid=3: reacting to signal 3
INFO/dalvikvm   threadid=3: reacting to signal 3
INFO/dalvikvm   Wrote stack traces to '/data/anr/traces.txt'
INFO/dalvikvm   Wrote stack traces to '/data/anr/traces.txt'
INFO/dalvikvm   Wrote stack traces to '/data/anr/traces.txt'
INFO/dalvikvm   threadid=3: reacting to signal 3
INFO/dalvikvm   threadid=3: reacting to signal 3
ERROR/dalvikvm  Failed to write stack traces to /data/anr/traces.txt (379 of 2308
INFO/dalvikvm   Wrote stack traces to '/data/anr/traces.txt'
INFO/dalvikvm   threadid=3: reacting to signal 3
ERROR/dalvikvm  Failed to write stack traces to /data/anr/traces.txt (1785 of 2784
ERROR/dalvikvm  Failed to write stack traces to /data/anr/traces.txt (-1 of 3335
ERROR/dalvikvm  Failed to write stack traces to /data/anr/traces.txt (-1 of 2316
ERROR/dalvikvm  Failed to write stack traces to /data/anr/traces.txt (-1 of 2337
INFO/dalvikvm   Wrote stack traces to '/data/anr/traces.txt'
INFO/dalvikvm   Wrote stack traces to '/data/anr/traces.txt'
ERROR/dalvikvm  Failed to write stack traces to /data/anr/traces.txt (1870 of 4332
INFO/dalvikvm   Wrote stack traces to '/data/anr/traces.txt'
INFO/dalvikvm   Wrote stack traces to '/data/anr/traces.txt'
DEBUG/SntpClient    request time failed: java.net.UnknownHostException: north-america.pool.ntp.org
DEBUG/SntpClient    request time failed: java.net.UnknownHostException: north-america.pool.ntp.org
DEBUG/SntpClient    request time failed: java.net.UnknownHostException: north-america.pool.ntp.org
DEBUG/VoldCmdListener   asec list
INFO/dumpstate  done
DEBUG/Zygote    Process 8761 terminated by signal (11)
Tefel
  • 411
  • 4
  • 3
  • crash should have fatal exception and be in red. Could you post that part. – Code Droid Aug 09 '12 at 18:13
  • Look for word fatal, this is always there with a crash then repost it. – Code Droid Aug 09 '12 at 18:14
  • red part is only: Wrote stack traces to '/data/anr/traces.txt' but it is from delvikm Meybe it is phone problem? Becouse i am writing over 500mb every time to my sdcard. I am doing cp commands for over 1 hour right now and there is no crash... – Tefel Aug 09 '12 at 18:28
  • The important line is the Signal 11. Its definitely invalid memory reference. I think if your .so files native where compiled for a different platform. is this an x86 device?. Maybe not compiled to run against that device. – Code Droid Aug 09 '12 at 18:32
  • Post the script that compiles the native libraries, and the type of device. Look for Android.mk file or something like that should have the comand used by JNI. – Code Droid Aug 09 '12 at 18:33
  • Zero in on signal 11 SIGSEVG and Android. This is a somewhat common issue. – Code Droid Aug 09 '12 at 18:40
  • Also see You can use ndk-stack to print out the crash dump of you app. Read the docs\NDK-STACK.html in your ndk directory for full step about using it. – Code Droid Aug 09 '12 at 18:44
  • But i am not using any native code :( In c++ i know when i have memory problems. Here i cant even debug my code becouse errors comes from outside. I have samsung galaxy s and 2.2. Is it possible that 2.3 version can solve this problem? Or meybe i should set some app configuration at start like heap size or smth? – Tefel Aug 09 '12 at 18:46
  • check this also: http://stackoverflow.com/questions/6137452/what-might-cause-this-error-in-android – Code Droid Aug 09 '12 at 18:50
  • Is there a webview in your app? – Code Droid Aug 09 '12 at 18:50
  • Tell us more about your app. Do you have webview and is there anything memory intensive in your app? – Code Droid Aug 09 '12 at 18:53
  • If I were you I would use the following code to monitor and print out memory usage and see if that's the issue inside the app. http://stackoverflow.com/questions/6069866/catch-flash-out-of-memory-error-in-webview – Code Droid Aug 09 '12 at 18:54
  • Just print this out right aways and log it in logcat. – Code Droid Aug 09 '12 at 18:54
  • No i dont have webview :). But i have large custom BaseAdapter which i refresh many times per sec. Ok i will try to monitor memory. – Tefel Aug 09 '12 at 19:00
  • Is it possible that executing notifyDataSetChanged many times per sec for very large adapter (7 imageviews, 2 textviews, 2 buttons, 1 progress bar) cause this problem? – Tefel Aug 09 '12 at 19:08
  • Its possible but you should really just test the memory usage at these points of interest and see what you get. – Code Droid Aug 09 '12 at 21:46

2 Answers2

0

This is due to an invalid memory reference. I would suggest it has to do with some native libraries. That is the meaning of the signal 11. Most likely not in java code I think. More likely an included jni library I would guess.

See also SIGNAL 11 SIGSEGV crash Android

You might need to clear the cache. Reaching Cache limit is another possibility.

To find out more you can use ndk-stack to print out the crash dump of you app. Read the docs\NDK-STACK.html in your ndk directory for full step about using it.

Might also be firmware: see Android Java App Crashing with SIGSEGV

Community
  • 1
  • 1
Code Droid
  • 10,344
  • 17
  • 72
  • 112
  • So i should resign from cp commands use other one or other java File copy methods? I think cp is a little bit faster than standard copy methods. – Tefel Aug 09 '12 at 18:32
  • see update above. You might need to increase cache size, but often this is due to native library issue. – Code Droid Aug 09 '12 at 18:40
  • No way to tell. You need to measure the memory usage. I would also profile the app while it is running. Frustrating problem, use this as an opportunity to learn more about memory management and monitoring on android a useful skill. – Code Droid Aug 09 '12 at 21:47
0

Please have a look at this sensation:

WORKS FINE:

while(true) {   
    long czas = android.os.SystemClock.uptimeMillis();
    Storage.executeCmd("cp /data/app/com.rerware.android.MyBackupRoot-1.apk /mnt/sdcard/allbackup/backup/aplikacja"+String.valueOf(czas)+".apk", null);
}   

WORKS FINE:

while(true) {   
    Message msg = new Message(); // customadapter.notifydatachanged() in main activity
    msg.arg1 = 1;
    mHandler.sendMessage(msg);
}   

CRASH AFTER 2 MIN (sleep = 100)

while(true) {   
    long czas = android.os.SystemClock.uptimeMillis();           
    Storage.executeCmd("cp /data/app/com.rerware.android.MyBackupRoot-1.apk /mnt/sdcard/allbackup/backup/aplikacja"+String.valueOf(czas)+".apk", null);
    sleep(100);

    Message msg = new Message(); // customadapter.notifydatachanged in main activity
    msg.arg1 = 1;
    mHandler.sendMessage(msg);
    Log.d("ods test", "ods test");                  
    sleep(100); 
}   

CRASH AFTER 25 MIN (sleep = 200)

while(true) {   
    long czas = android.os.SystemClock.uptimeMillis();           
    Storage.executeCmd("cp /data/app/com.rerware.android.MyBackupRoot-1.apk /mnt/sdcard/allbackup/backup/aplikacja"+String.valueOf(czas)+".apk", null);
    sleep(200);

    Message msg = new Message(); // customadapter.notifydatachanged in main activity
    msg.arg1 = 1;
    mHandler.sendMessage(msg);
    Log.d("ods test", "ods test");               
    sleep(200);
}

one question WHAAAAAAAAAT? There has to be processes conflict... becouse cp command create new process in ps list

PS: 1000ms delay seems WORKS FINE (tested 2h)

Tefel
  • 411
  • 4
  • 3