2014-02-16 187 views
2

我最近有很多崩潰的應用程序,我不明白這個問題。的logcat的輸出是:CaseMapper.toLowerCase導致應用程序崩潰

02-16 18:47:44.839: D/dalvikvm(7264): JIT unchain all for threadid=1 
02-16 18:47:45.589: W/dalvikvm(7264): threadid=14: spin on suspend #1 threadid=1 (pcf=0) 
02-16 18:47:46.339: W/dalvikvm(7264): threadid=14: spin on suspend #2 threadid=1 (pcf=0) 
02-16 18:47:46.340: I/dalvikvm(7264): "Thread-2069" prio=5 tid=14 RUNNABLE JIT 
02-16 18:47:46.340: I/dalvikvm(7264): | group="main" sCount=0 dsCount=0 obj=0x41f13920 self=0x5f259a38 
02-16 18:47:46.340: I/dalvikvm(7264): | sysTid=7715 nice=0 sched=0/0 cgrp=apps handle=1596300944 
02-16 18:47:46.340: I/dalvikvm(7264): | state=R schedstat=(0 0 0) utm=7 stm=4 core=1 
02-16 18:47:46.340: I/dalvikvm(7264): at java.lang.CaseMapper.toLowerCase(CaseMapper.java:~67) 
02-16 18:47:46.340: I/dalvikvm(7264): at java.lang.String.toLowerCase(String.java:1496) 
02-16 18:47:46.340: I/dalvikvm(7264): at de.malaka.player.utils.DBUtils.getTracksFromFolderWithoutSubfolder(DBUtils.java:384) 
02-16 18:47:46.340: I/dalvikvm(7264): at de.malaka.player.fragment.FolderFragment$9.run(FolderFragment.java:615) 
02-16 18:47:46.340: I/dalvikvm(7264): "main" prio=5 tid=1 RUNNABLE JIT 
02-16 18:47:46.340: I/dalvikvm(7264): | group="main" sCount=1 dsCount=0 obj=0x41619e40 self=0x4153a828 
02-16 18:47:46.340: I/dalvikvm(7264): | sysTid=7264 nice=0 sched=0/0 cgrp=apps handle=1073856852 
02-16 18:47:46.340: I/dalvikvm(7264): | state=R schedstat=(0 0 0) utm=1482 stm=147 core=0 
02-16 18:47:46.340: I/dalvikvm(7264): at de.malaka.player.fragment.FolderFragment.finishFillPath(FolderFragment.java:~676) 
02-16 18:47:46.340: I/dalvikvm(7264): at de.malaka.player.fragment.FolderFragment.onBackClicked(FolderFragment.java:517) 
02-16 18:47:46.340: I/dalvikvm(7264): at de.malaka.player.MainActivity.onBackPressed(MainActivity.java:736) 
02-16 18:47:46.340: I/dalvikvm(7264): at android.app.Activity.onKeyUp(Activity.java:2201) 
02-16 18:47:46.340: I/dalvikvm(7264): at android.view.KeyEvent.dispatch(KeyEvent.java:2664) 
02-16 18:47:46.340: I/dalvikvm(7264): at android.app.Activity.dispatchKeyEvent(Activity.java:2431) 
02-16 18:47:46.340: I/dalvikvm(7264): at android.support.v7.app.ActionBarActivityDelegateICS$WindowCallbackWrapper.dispatchKeyEvent(ActionBarActivityDelegateICS.java:245) 

我有超過100行的是輸出中的上述和然後在最後我有此logcat的輸出:

02-16 18:47:52.415: I/dalvikvm(7264): "Binder_2" prio=5 tid=10 NATIVE 
02-16 18:47:52.415: I/dalvikvm(7264): | group="main" sCount=1 dsCount=0 obj=0x41eecd98 self=0x5eca6008 
02-16 18:47:52.415: I/dalvikvm(7264): | sysTid=7276 nice=0 sched=0/0 cgrp=apps handle=1533152376 
02-16 18:47:52.415: I/dalvikvm(7264): | state=S schedstat=(0 0 0) utm=0 stm=0 core=0 
02-16 18:47:52.418: I/dalvikvm(7264): #00 pc 00020660 /system/lib/libc.so (__ioctl+8) 
02-16 18:47:52.418: I/dalvikvm(7264): #01 pc 0002cdb7 /system/lib/libc.so (ioctl+14) 
02-16 18:47:52.418: I/dalvikvm(7264): #02 pc 0001d375 /system/lib/libbinder.so (android::IPCThreadState::talkWithDriver(bool)+140) 
02-16 18:47:52.418: I/dalvikvm(7264): #03 pc 0001da7f /system/lib/libbinder.so (android::IPCThreadState::getAndExecuteCommand()+6) 
02-16 18:47:52.418: I/dalvikvm(7264): #04 pc 0001db15 /system/lib/libbinder.so (android::IPCThreadState::joinThreadPool(bool)+48) 
02-16 18:47:52.418: I/dalvikvm(7264): #05 pc 00021939 /system/lib/libbinder.so 
02-16 18:47:52.418: I/dalvikvm(7264): #06 pc 0000ea75 /system/lib/libutils.so (android::Thread::_threadLoop(void*)+216) 
02-16 18:47:52.418: I/dalvikvm(7264): #07 pc 0004d091 /system/lib/libandroid_runtime.so (android::AndroidRuntime::javaThreadShell(void*)+68) 
02-16 18:47:52.418: I/dalvikvm(7264): #08 pc 0000e59d /system/lib/libutils.so 
02-16 18:47:52.418: I/dalvikvm(7264): #09 pc 0000d240 /system/lib/libc.so (__thread_entry+72) 
02-16 18:47:52.418: I/dalvikvm(7264): #10 pc 0000d3d8 /system/lib/libc.so (pthread_create+240) 
02-16 18:47:52.418: I/dalvikvm(7264): at dalvik.system.NativeStart.run(Native Method) 
02-16 18:47:52.418: I/dalvikvm(7264): "Binder_1" prio=5 tid=9 NATIVE 
02-16 18:47:52.418: I/dalvikvm(7264): | group="main" sCount=1 dsCount=0 obj=0x41eecbb8 self=0x5b620250 
02-16 18:47:52.418: I/dalvikvm(7264): | sysTid=7275 nice=0 sched=0/0 cgrp=apps handle=1533149192 
02-16 18:47:52.418: I/dalvikvm(7264): | state=S schedstat=(0 0 0) utm=0 stm=0 core=0 
02-16 18:47:52.420: I/dalvikvm(7264): #00 pc 00020660 /system/lib/libc.so (__ioctl+8) 
02-16 18:47:52.420: I/dalvikvm(7264): #01 pc 0002cdb7 /system/lib/libc.so (ioctl+14) 
02-16 18:47:52.420: I/dalvikvm(7264): #02 pc 0001d375 /system/lib/libbinder.so (android::IPCThreadState::talkWithDriver(bool)+140) 
02-16 18:47:52.420: I/dalvikvm(7264): #03 pc 0001da7f /system/lib/libbinder.so (android::IPCThreadState::getAndExecuteCommand()+6) 
02-16 18:47:52.420: I/dalvikvm(7264): #04 pc 0001db15 /system/lib/libbinder.so (android::IPCThreadState::joinThreadPool(bool)+48) 
02-16 18:47:52.420: I/dalvikvm(7264): #05 pc 00021939 /system/lib/libbinder.so 
02-16 18:47:52.421: I/dalvikvm(7264): #06 pc 0000ea75 /system/lib/libutils.so (android::Thread::_threadLoop(void*)+216) 
02-16 18:47:52.421: I/dalvikvm(7264): #07 pc 0004d091 /system/lib/libandroid_runtime.so (android::AndroidRuntime::javaThreadShell(void*)+68) 
02-16 18:47:52.421: I/dalvikvm(7264): #08 pc 0000e59d /system/lib/libutils.so 
02-16 18:47:52.421: I/dalvikvm(7264): #09 pc 0000d240 /system/lib/libc.so (__thread_entry+72) 
02-16 18:47:52.421: I/dalvikvm(7264): #10 pc 0000d3d8 /system/lib/libc.so (pthread_create+240) 
02-16 18:47:52.421: I/dalvikvm(7264): at dalvik.system.NativeStart.run(Native Method) 
02-16 18:47:52.421: I/dalvikvm(7264): "FinalizerWatchdogDaemon" daemon prio=5 tid=8 WAIT 
02-16 18:47:52.421: I/dalvikvm(7264): | group="system" sCount=1 dsCount=0 obj=0x41ee99b8 self=0x5b51f330 
02-16 18:47:52.421: I/dalvikvm(7264): | sysTid=7274 nice=0 sched=0/0 cgrp=apps handle=1532098440 
02-16 18:47:52.421: I/dalvikvm(7264): | state=S schedstat=(0 0 0) utm=0 stm=0 core=0 
02-16 18:47:52.421: I/dalvikvm(7264): at java.lang.Object.wait(Native Method) 
02-16 18:47:52.421: I/dalvikvm(7264): - waiting on <0x416234e8> (a java.lang.Daemons$FinalizerWatchdogDaemon) 
02-16 18:47:52.421: I/dalvikvm(7264): at java.lang.Object.wait(Object.java:364) 
02-16 18:47:52.421: I/dalvikvm(7264): at java.lang.Daemons$FinalizerWatchdogDaemon.waitForObject(Daemons.java:230) 
02-16 18:47:52.421: I/dalvikvm(7264): at java.lang.Daemons$FinalizerWatchdogDaemon.run(Daemons.java:207) 
02-16 18:47:52.421: I/dalvikvm(7264): at java.lang.Thread.run(Thread.java:841) 
02-16 18:47:52.421: I/dalvikvm(7264): "FinalizerDaemon" daemon prio=5 tid=7 WAIT 
02-16 18:47:52.421: I/dalvikvm(7264): | group="system" sCount=1 dsCount=0 obj=0x41ee9808 self=0x5e3e58c0 
02-16 18:47:52.421: I/dalvikvm(7264): | sysTid=7273 nice=0 sched=0/0 cgrp=apps handle=1581145368 
02-16 18:47:52.421: I/dalvikvm(7264): | state=S schedstat=(0 0 0) utm=7 stm=1 core=1 
02-16 18:47:52.421: I/dalvikvm(7264): at java.lang.Object.wait(Native Method) 
02-16 18:47:52.421: I/dalvikvm(7264): - waiting on <0x4160e7d8> (a java.lang.ref.ReferenceQueue) 
02-16 18:47:52.421: I/dalvikvm(7264): at java.lang.Object.wait(Object.java:401) 
02-16 18:47:52.422: I/dalvikvm(7264): at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:102) 
02-16 18:47:52.422: I/dalvikvm(7264): at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:73) 
02-16 18:47:52.422: I/dalvikvm(7264): at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:170) 
02-16 18:47:52.422: I/dalvikvm(7264): at java.lang.Thread.run(Thread.java:841) 
02-16 18:47:52.422: I/dalvikvm(7264): "ReferenceQueueDaemon" daemon prio=5 tid=6 WAIT 
02-16 18:47:52.422: I/dalvikvm(7264): | group="system" sCount=1 dsCount=0 obj=0x41ee96a0 self=0x5e3e5018 
02-16 18:47:52.422: I/dalvikvm(7264): | sysTid=7272 nice=0 sched=0/0 cgrp=apps handle=1581143152 
02-16 18:47:52.422: I/dalvikvm(7264): | state=S schedstat=(0 0 0) utm=0 stm=0 core=0 
02-16 18:47:52.422: I/dalvikvm(7264): at java.lang.Object.wait(Native Method) 
02-16 18:47:52.422: I/dalvikvm(7264): - waiting on <0x4160e700> 
02-16 18:47:52.422: I/dalvikvm(7264): at java.lang.Object.wait(Object.java:364) 
02-16 18:47:52.422: I/dalvikvm(7264): at java.lang.Daemons$ReferenceQueueDaemon.run(Daemons.java:130) 
02-16 18:47:52.422: I/dalvikvm(7264): at java.lang.Thread.run(Thread.java:841) 
02-16 18:47:52.422: I/dalvikvm(7264): "Compiler" daemon prio=5 tid=5 VMWAIT 
02-16 18:47:52.422: I/dalvikvm(7264): | group="system" sCount=1 dsCount=0 obj=0x41ee95b0 self=0x5e3e49b8 
02-16 18:47:52.422: I/dalvikvm(7264): | sysTid=7271 nice=0 sched=0/0 cgrp=apps handle=1581139824 
02-16 18:47:52.422: I/dalvikvm(7264): | state=S schedstat=(0 0 0) utm=12 stm=7 core=0 
02-16 18:47:52.423: I/dalvikvm(7264): #00 pc 000219dc /system/lib/libc.so (__futex_syscall3+8) 
02-16 18:47:52.423: I/dalvikvm(7264): #01 pc 0000ef94 /system/lib/libc.so (__pthread_cond_timedwait_relative+48) 
02-16 18:47:52.423: I/dalvikvm(7264): #02 pc 0000effc /system/lib/libc.so (__pthread_cond_timedwait+64) 
02-16 18:47:52.423: I/dalvikvm(7264): #03 pc 00076e73 /system/lib/libdvm.so 
02-16 18:47:52.423: I/dalvikvm(7264): #04 pc 00057841 /system/lib/libdvm.so 
02-16 18:47:52.423: I/dalvikvm(7264): #05 pc 0000d240 /system/lib/libc.so (__thread_entry+72) 
02-16 18:47:52.423: I/dalvikvm(7264): #06 pc 0000d3d8 /system/lib/libc.so (pthread_create+240) 
02-16 18:47:52.423: I/dalvikvm(7264): at dalvik.system.NativeStart.run(Native Method) 
02-16 18:47:52.423: I/dalvikvm(7264): "JDWP" daemon prio=5 tid=4 VMWAIT 
02-16 18:47:52.423: I/dalvikvm(7264): | group="system" sCount=1 dsCount=0 obj=0x41ee94c8 self=0x5e3e4110 
02-16 18:47:52.423: I/dalvikvm(7264): | sysTid=7270 nice=0 sched=0/0 cgrp=apps handle=1096844008 
02-16 18:47:52.423: I/dalvikvm(7264): | state=S schedstat=(0 0 0) utm=0 stm=0 core=2 
02-16 18:47:52.424: I/dalvikvm(7264): #00 pc 000207b0 /system/lib/libc.so (select+20) 
02-16 18:47:52.424: I/dalvikvm(7264): #01 pc 0006437b /system/lib/libdvm.so 
02-16 18:47:52.424: I/dalvikvm(7264): #02 pc 00066ee1 /system/lib/libdvm.so 
02-16 18:47:52.424: I/dalvikvm(7264): #03 pc 00057841 /system/lib/libdvm.so 
02-16 18:47:52.424: I/dalvikvm(7264): #04 pc 0000d240 /system/lib/libc.so (__thread_entry+72) 
02-16 18:47:52.424: I/dalvikvm(7264): #05 pc 0000d3d8 /system/lib/libc.so (pthread_create+240) 
02-16 18:47:52.424: I/dalvikvm(7264): at dalvik.system.NativeStart.run(Native Method) 
02-16 18:47:52.424: I/dalvikvm(7264): "Signal Catcher" daemon prio=5 tid=3 SUSPENDED 
02-16 18:47:52.424: I/dalvikvm(7264): | group="system" sCount=1 dsCount=0 obj=0x41ee93d0 self=0x58572a58 
02-16 18:47:52.424: I/dalvikvm(7264): | sysTid=7269 nice=0 sched=0/0 cgrp=apps handle=1482106896 
02-16 18:47:52.424: I/dalvikvm(7264): | state=S schedstat=(0 0 0) utm=0 stm=0 core=0 
02-16 18:47:52.426: I/dalvikvm(7264): #00 pc 000219dc /system/lib/libc.so (__futex_syscall3+8) 
02-16 18:47:52.426: I/dalvikvm(7264): #01 pc 0000ef94 /system/lib/libc.so (__pthread_cond_timedwait_relative+48) 
02-16 18:47:52.426: I/dalvikvm(7264): #02 pc 0000effc /system/lib/libc.so (__pthread_cond_timedwait+64) 
02-16 18:47:52.426: I/dalvikvm(7264): #03 pc 0005658b /system/lib/libdvm.so 
02-16 18:47:52.426: I/dalvikvm(7264): #04 pc 00056b4d /system/lib/libdvm.so (dvmChangeStatus(Thread*, ThreadStatus)+34) 
02-16 18:47:52.426: I/dalvikvm(7264): #05 pc 00054cd7 /system/lib/libdvm.so 
02-16 18:47:52.426: I/dalvikvm(7264): #06 pc 00057841 /system/lib/libdvm.so 
02-16 18:47:52.426: I/dalvikvm(7264): #07 pc 0000d240 /system/lib/libc.so (__thread_entry+72) 
02-16 18:47:52.426: I/dalvikvm(7264): #08 pc 0000d3d8 /system/lib/libc.so (pthread_create+240) 
02-16 18:47:52.426: I/dalvikvm(7264): at dalvik.system.NativeStart.run(Native Method) 
02-16 18:47:52.426: I/dalvikvm(7264): "GC" daemon prio=5 tid=2 VMWAIT 
02-16 18:47:52.426: I/dalvikvm(7264): | group="system" sCount=1 dsCount=0 obj=0x41ee92f0 self=0x5b64b258 
02-16 18:47:52.426: I/dalvikvm(7264): | sysTid=7268 nice=0 sched=0/0 cgrp=apps handle=1533323936 
02-16 18:47:52.426: I/dalvikvm(7264): | state=S schedstat=(0 0 0) utm=1 stm=9 core=1 
02-16 18:47:52.428: I/dalvikvm(7264): #00 pc 000219dc /system/lib/libc.so (__futex_syscall3+8) 
02-16 18:47:52.428: I/dalvikvm(7264): #01 pc 0000ef94 /system/lib/libc.so (__pthread_cond_timedwait_relative+48) 
02-16 18:47:52.428: I/dalvikvm(7264): #02 pc 0000effc /system/lib/libc.so (__pthread_cond_timedwait+64) 
02-16 18:47:52.428: I/dalvikvm(7264): #03 pc 00075837 /system/lib/libdvm.so 
02-16 18:47:52.428: I/dalvikvm(7264): #04 pc 00057841 /system/lib/libdvm.so 
02-16 18:47:52.428: I/dalvikvm(7264): #05 pc 0000d240 /system/lib/libc.so (__thread_entry+72) 
02-16 18:47:52.428: I/dalvikvm(7264): #06 pc 0000d3d8 /system/lib/libc.so (pthread_create+240) 
02-16 18:47:52.428: I/dalvikvm(7264): at dalvik.system.NativeStart.run(Native Method) 
02-16 18:47:52.428: I/dalvikvm(7264): NATIVE THREADS: 
02-16 18:47:52.428: I/dalvikvm(7264): "GL updater" sysTid=7301 nice=-10 sched=0/0 cgrp=apps 
02-16 18:47:52.428: I/dalvikvm(7264): | state=S schedstat=(0 0 0) utm=2 stm=12 core=0 
02-16 18:47:52.428: E/dalvikvm(7264): threadid=14: stuck on threadid=1, giving up 
02-16 18:47:52.429: D/dalvikvm(7264): threadid=14: sending two SIGSTKFLTs to threadid=1 (tid=7264) to cause debuggerd dump 
02-16 18:47:52.431: A/libc(7264): Fatal signal 16 (SIGSTKFLT) at 0x00001c60 (code=-6), thread 7264 (e.malaka.player) 

當它發生
我進行數據庫查詢以獲取子文件夾中的所有軌道,然後檢查文件是否在特定文件夾中,而不是在具有正則表達式的子文件夾中。這是代碼:

public static final String DATA = MediaStore.Audio.Media.DATA; 

public static void getTracksFromFolderWithoutSubfolder(
     Context context, File f, ArrayList<TrackInfo> q, 
     int icon) { 

    String pattern = Pattern.quote(f.getAbsolutePath().toLowerCase()) + "/[^/]*"; 
    Cursor mCursor = null; 

    String selection = MediaStore.Audio.Media.IS_MUSIC + " != 0 AND " + DATA + " LIKE \"" + f.getAbsolutePath() + "/%\""; 
    Uri contentUri = Media.getContentUriForPath(Environment.getExternalStorageDirectory().getPath()); 
    String projection[] = new String[]{DATA}; 

    mCursor = context.getContentResolver().query(contentUri, projection, selection, null, DATA); 

    String data, fileName[]; 
    while(mCursor.moveToNext()){ 

     data = mCursor.getString(0);  
     if(data.toLowerCase().matches(pattern)){ // this is the line the logcat refers to 
      fileName = data.split("/"); 
      q.add(new TrackInfo(fileName[fileName.length-1], null, data, null, -1, icon, false)); 
     } 


    } 

    mCursor.close(); 

} 

錯誤似乎只如果我把這個方法與File f爲我的音樂設備(約1200音樂文件,包括子文件夾)上的主文件夾中發生。但它不會每次都發生。事實上,在十次調用中它大約發生兩次或三次。

有人可以告訴我這可能來自哪裏?也許我缺少釋放一些資源或類似的東西..
我目前用Moto G的工作,是Android 4.4

感謝

+0

這裏只有一個問題 - 您從Android操作系統下的Linux操作系統獲得了SIGSTKFLT。當一個協處理器告訴主處理器它的堆棧處於不良狀態(通常是空的或滿的)時,這種情況很少發生。 –

+0

啊,所以這意味着我的問題是'threadid = 1'? – MalaKa

+0

可能但不一定。在這裏你有一個真正的不尋常的案例,我從來沒有真正看到堆棧錯誤 - 腐敗的堆棧通常只會引發最終的段錯誤。如果它是由一個協處理器引起的,那麼它可能只是在主線程上佔了上風。僅供參考,所有線程都被拋棄的原因是,每當信號殺死一個進程時,Android的行爲就像這樣,以最大化調試信息。 –

回答

0

因此關閉問題:

結合這些logcat的線:
從第二輸出

02-16 18:47:52.429: D/dalvikvm(7264): threadid=14: sending two SIGSTKFLTs to threadid=1 (tid=7264) to cause debuggerd dump 

從第一歐tput的

02-16 18:47:46.340: I/dalvikvm(7264): "main" prio=5 tid=1 RUNNABLE JIT 
02-16 18:47:46.340: I/dalvikvm(7264): | group="main" sCount=1 dsCount=0 obj=0x41619e40 self=0x4153a828 
02-16 18:47:46.340: I/dalvikvm(7264): | sysTid=7264 nice=0 sched=0/0 cgrp=apps handle=1073856852 
02-16 18:47:46.340: I/dalvikvm(7264): | state=R schedstat=(0 0 0) utm=1482 stm=147 core=0 
02-16 18:47:46.340: I/dalvikvm(7264): at de.malaka.player.fragment.FolderFragment.finishFillPath(FolderFragment.java:~676) 

我有一個仔細端詳了的FolderFragment.finishFillPath(FolderFragment.java:~676)。在那裏,我發現一段代碼讓UIThread主動等待後臺線程完成。我爲了調試的原因介紹了這一行,並忘記刪除它。
在我的情況
所以,以下行(從第二輸出):

02-16 18:47:52.428: E/dalvikvm(7264): threadid=14: stuck on threadid=1, giving up 

表示,UI線程等待太久..

@Gabe Sechan
感謝幫助