Fatal Spin-On-Suspend / Stuck on ThreadID

Я создаю специальный календарь для Android-приложения. Теперь он работает так, что он вытягивает события из онлайн-базы данных MySQL, передает их в JSONArray и вводит их в календарь оттуда. Он работал нормально (если немного медленнее) на эмуляторе, но сегодня я подключил свой S3, и он дает мне ошибки, которые я еще не получил. Ошибки, которые я получаю в своем журнале, говорят:

09-14 22: 52: 12.611: E / dalvikvm (4605): threadid = 2: застрял на threadid = 1, отказавшись

09-14 22: 52: 12.611: E / dalvikvm (4605): смертельные отсроченные, сбрасываемые нити

Это ASyncTask, что он постоянно зависает:

package com.legends.app; import java.io.BufferedReader; import java.io.InputStream; import java.io.InputStreamReader; import org.apache.http.HttpEntity; import org.apache.http.HttpResponse; import org.apache.http.client.HttpClient; import org.apache.http.client.methods.HttpPost; import org.apache.http.impl.client.DefaultHttpClient; import org.json.JSONArray; import android.os.AsyncTask; import android.util.Log; public class Events extends AsyncTask<Void, Void, String> { JSONArray jArray; public String result = null; InputStream is = null; StringBuilder sb=null; HttpEntity entity; protected String doInBackground(Void... arg0) { //http post - calls from the php file that opens the DB try{ HttpClient httpclient = new DefaultHttpClient(); HttpPost httppost = new HttpPost("http://legendsofnotredame.org/club/mobile/android/cal.php"); HttpResponse response = httpclient.execute(httppost); entity = response.getEntity(); }catch(Exception e){ Log.e("log_tag", "Error in http connection"+e.toString()); } //convert response to string try{ is = entity.getContent(); BufferedReader reader = new BufferedReader(new InputStreamReader(is,"iso-8859-1"),8); sb = new StringBuilder(); sb.append(reader.readLine() + "\n"); String line="0"; while ((line = reader.readLine()) != null) { sb.append(line + "\n"); } is.close(); result=sb.toString(); }catch(Exception e){ Log.e("log_tag", "Error converting result "+e.toString()); } Log.e("test","Converted results to string"); return result; } protected void onPostExecute(String result) { } } 

После добавления тонны журналов я решил, что он повесился на «sb.append (reader.readLine () +« \ n »);», и я не уверен, как сделать это не так. Какие-нибудь советы?

Редактировать: Вот (почти) полный логарифм для его запуска, начиная с того места, где он зависает на readLine. Мне приходилось мириться с некоторыми строками без предупреждения / без ошибок в начале, потому что этот пост слишком длинный, извините!

 09-15 14:02:13.251: W/dalvikvm(21710): threadid=2: spin on suspend #1 threadid=1 (pcf=0) 09-15 14:02:14.001: W/dalvikvm(21710): threadid=2: spin on suspend #2 threadid=1 (pcf=0) 09-15 14:02:14.752: W/dalvikvm(21710): threadid=2: spin on suspend #3 threadid=1 (pcf=0) 09-15 14:02:15.503: W/dalvikvm(21710): threadid=2: spin on suspend #4 threadid=1 (pcf=0) 09-15 14:02:16.254: W/dalvikvm(21710): threadid=2: spin on suspend #5 threadid=1 (pcf=0) 09-15 14:02:16.254: I/dalvikvm(21710): "GC" daemon prio=5 tid=2 RUNNABLE 09-15 14:02:16.254: I/dalvikvm(21710): | group="system" sCount=0 dsCount=0 obj=0x419b4d68 self=0x124d8e8 09-15 14:02:16.254: I/dalvikvm(21710): | sysTid=21712 nice=0 sched=0/0 cgrp=default handle=19191584 09-15 14:02:16.254: I/dalvikvm(21710): | schedstat=( 0 0 0 ) utm=0 stm=0 core=0 09-15 14:02:16.254: I/dalvikvm(21710): at dalvik.system.NativeStart.run(Native Method) 09-15 14:02:16.254: I/dalvikvm(21710): "main" prio=5 tid=1 RUNNABLE JIT 09-15 14:02:16.254: I/dalvikvm(21710): | group="main" sCount=1 dsCount=0 obj=0x40c3fcd0 self=0x10c2c30 09-15 14:02:16.254: I/dalvikvm(21710): | sysTid=21710 nice=0 sched=0/0 cgrp=default handle=1074750856 09-15 14:02:16.254: I/dalvikvm(21710): | schedstat=( 0 0 0 ) utm=640 stm=5 core=0 09-15 14:02:16.254: I/dalvikvm(21710): at com.legends.app.CalendarActivity.onCreate(CalendarActivity.java:~122) 09-15 14:02:16.254: I/dalvikvm(21710): at android.app.Activity.performCreate(Activity.java:4470) 09-15 14:02:16.254: I/dalvikvm(21710): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1053) 09-15 14:02:16.254: I/dalvikvm(21710): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1934) 09-15 14:02:16.254: I/dalvikvm(21710): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995) 09-15 14:02:16.254: I/dalvikvm(21710): at android.app.ActivityThread.access$600(ActivityThread.java:128) 09-15 14:02:16.254: I/dalvikvm(21710): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161) 09-15 14:02:16.254: I/dalvikvm(21710): at android.os.Handler.dispatchMessage(Handler.java:99) 09-15 14:02:16.254: I/dalvikvm(21710): at android.os.Looper.loop(Looper.java:137) 09-15 14:02:16.254: I/dalvikvm(21710): at android.app.ActivityThread.main(ActivityThread.java:4514) 09-15 14:02:16.254: I/dalvikvm(21710): at java.lang.reflect.Method.invokeNative(Native Method) 09-15 14:02:16.254: I/dalvikvm(21710): at java.lang.reflect.Method.invoke(Method.java:511) 09-15 14:02:16.254: I/dalvikvm(21710): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:980) 09-15 14:02:16.254: I/dalvikvm(21710): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747) 09-15 14:02:16.254: I/dalvikvm(21710): at dalvik.system.NativeStart.main(Native Method) 09-15 14:02:17.005: W/dalvikvm(21710): threadid=2: spin on suspend #6 threadid=1 (pcf=0) 09-15 14:02:17.005: I/dalvikvm(21710): "GC" daemon prio=5 tid=2 RUNNABLE 09-15 14:02:17.005: I/dalvikvm(21710): | group="system" sCount=0 dsCount=0 obj=0x419b4d68 self=0x124d8e8 09-15 14:02:17.005: I/dalvikvm(21710): | sysTid=21712 nice=0 sched=0/0 cgrp=default handle=19191584 09-15 14:02:17.005: I/dalvikvm(21710): | schedstat=( 0 0 0 ) utm=0 stm=0 core=0 09-15 14:02:17.005: I/dalvikvm(21710): at dalvik.system.NativeStart.run(Native Method) 09-15 14:02:17.005: I/dalvikvm(21710): "main" prio=5 tid=1 RUNNABLE JIT 09-15 14:02:17.005: I/dalvikvm(21710): | group="main" sCount=1 dsCount=0 obj=0x40c3fcd0 self=0x10c2c30 09-15 14:02:17.005: I/dalvikvm(21710): | sysTid=21710 nice=0 sched=0/0 cgrp=default handle=1074750856 09-15 14:02:17.005: I/dalvikvm(21710): | schedstat=( 0 0 0 ) utm=712 stm=5 core=0 09-15 14:02:17.015: I/dalvikvm(21710): at com.legends.app.CalendarActivity.onCreate(CalendarActivity.java:~122) 09-15 14:02:17.015: I/dalvikvm(21710): at android.app.Activity.performCreate(Activity.java:4470) 09-15 14:02:17.015: I/dalvikvm(21710): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1053) 09-15 14:02:17.015: I/dalvikvm(21710): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1934) 09-15 14:02:17.015: I/dalvikvm(21710): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995) 09-15 14:02:17.015: I/dalvikvm(21710): at android.app.ActivityThread.access$600(ActivityThread.java:128) 09-15 14:02:17.015: I/dalvikvm(21710): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161) 09-15 14:02:17.015: I/dalvikvm(21710): at android.os.Handler.dispatchMessage(Handler.java:99) 09-15 14:02:17.015: I/dalvikvm(21710): at android.os.Looper.loop(Looper.java:137) 09-15 14:02:17.015: I/dalvikvm(21710): at android.app.ActivityThread.main(ActivityThread.java:4514) 09-15 14:02:17.015: I/dalvikvm(21710): at java.lang.reflect.Method.invokeNative(Native Method) 09-15 14:02:17.015: I/dalvikvm(21710): at java.lang.reflect.Method.invoke(Method.java:511) 09-15 14:02:17.015: I/dalvikvm(21710): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:980) 09-15 14:02:17.015: I/dalvikvm(21710): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747) 09-15 14:02:17.015: I/dalvikvm(21710): at dalvik.system.NativeStart.main(Native Method) 09-15 14:02:17.765: W/dalvikvm(21710): threadid=2: spin on suspend #7 threadid=1 (pcf=0) 09-15 14:02:17.765: I/dalvikvm(21710): "GC" daemon prio=5 tid=2 RUNNABLE 09-15 14:02:17.765: I/dalvikvm(21710): | group="system" sCount=0 dsCount=0 obj=0x419b4d68 self=0x124d8e8 09-15 14:02:17.765: I/dalvikvm(21710): | sysTid=21712 nice=0 sched=0/0 cgrp=default handle=19191584 09-15 14:02:17.765: I/dalvikvm(21710): | schedstat=( 0 0 0 ) utm=0 stm=0 core=0 09-15 14:02:17.765: I/dalvikvm(21710): at dalvik.system.NativeStart.run(Native Method) 09-15 14:02:17.765: I/dalvikvm(21710): "main" prio=5 tid=1 RUNNABLE JIT 09-15 14:02:17.765: I/dalvikvm(21710): | group="main" sCount=1 dsCount=0 obj=0x40c3fcd0 self=0x10c2c30 09-15 14:02:17.765: I/dalvikvm(21710): | sysTid=21710 nice=0 sched=0/0 cgrp=default handle=1074750856 09-15 14:02:17.765: I/dalvikvm(21710): | schedstat=( 0 0 0 ) utm=762 stm=5 core=0 09-15 14:02:17.765: I/dalvikvm(21710): at com.legends.app.CalendarActivity.onCreate(CalendarActivity.java:~122) 09-15 14:02:17.765: I/dalvikvm(21710): at android.app.Activity.performCreate(Activity.java:4470) 09-15 14:02:17.765: I/dalvikvm(21710): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1053) 09-15 14:02:17.765: I/dalvikvm(21710): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1934) 09-15 14:02:17.765: I/dalvikvm(21710): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995) 09-15 14:02:17.765: I/dalvikvm(21710): at android.app.ActivityThread.access$600(ActivityThread.java:128) 09-15 14:02:17.765: I/dalvikvm(21710): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161) 09-15 14:02:17.765: I/dalvikvm(21710): at android.os.Handler.dispatchMessage(Handler.java:99) 09-15 14:02:17.765: I/dalvikvm(21710): at android.os.Looper.loop(Looper.java:137) 09-15 14:02:17.765: I/dalvikvm(21710): at android.app.ActivityThread.main(ActivityThread.java:4514) 09-15 14:02:17.765: I/dalvikvm(21710): at java.lang.reflect.Method.invokeNative(Native Method) 09-15 14:02:17.765: I/dalvikvm(21710): at java.lang.reflect.Method.invoke(Method.java:511) 09-15 14:02:17.765: I/dalvikvm(21710): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:980) 09-15 14:02:17.765: I/dalvikvm(21710): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747) 09-15 14:02:17.765: I/dalvikvm(21710): at dalvik.system.NativeStart.main(Native Method) 09-15 14:02:18.516: W/dalvikvm(21710): threadid=2: spin on suspend #8 threadid=1 (pcf=0) 09-15 14:02:18.516: I/dalvikvm(21710): "GC" daemon prio=5 tid=2 RUNNABLE 09-15 14:02:18.516: I/dalvikvm(21710): | group="system" sCount=0 dsCount=0 obj=0x419b4d68 self=0x124d8e8 09-15 14:02:18.516: I/dalvikvm(21710): | sysTid=21712 nice=0 sched=0/0 cgrp=default handle=19191584 09-15 14:02:18.516: I/dalvikvm(21710): | schedstat=( 0 0 0 ) utm=0 stm=0 core=0 09-15 14:02:18.516: I/dalvikvm(21710): at dalvik.system.NativeStart.run(Native Method) 09-15 14:02:18.516: I/dalvikvm(21710): "main" prio=5 tid=1 RUNNABLE JIT 09-15 14:02:18.516: I/dalvikvm(21710): | group="main" sCount=1 dsCount=0 obj=0x40c3fcd0 self=0x10c2c30 09-15 14:02:18.516: I/dalvikvm(21710): | sysTid=21710 nice=0 sched=0/0 cgrp=default handle=1074750856 09-15 14:02:18.516: I/dalvikvm(21710): | schedstat=( 0 0 0 ) utm=834 stm=5 core=0 09-15 14:02:18.516: I/dalvikvm(21710): at com.legends.app.CalendarActivity.onCreate(CalendarActivity.java:~122) 09-15 14:02:18.516: I/dalvikvm(21710): at android.app.Activity.performCreate(Activity.java:4470) 09-15 14:02:18.516: I/dalvikvm(21710): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1053) 09-15 14:02:18.516: I/dalvikvm(21710): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1934) 09-15 14:02:18.516: I/dalvikvm(21710): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995) 09-15 14:02:18.516: I/dalvikvm(21710): at android.app.ActivityThread.access$600(ActivityThread.java:128) 09-15 14:02:18.516: I/dalvikvm(21710): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161) 09-15 14:02:18.516: I/dalvikvm(21710): at android.os.Handler.dispatchMessage(Handler.java:99) 09-15 14:02:18.516: I/dalvikvm(21710): at android.os.Looper.loop(Looper.java:137) 09-15 14:02:18.516: I/dalvikvm(21710): at android.app.ActivityThread.main(ActivityThread.java:4514) 09-15 14:02:18.516: I/dalvikvm(21710): at java.lang.reflect.Method.invokeNative(Native Method) 09-15 14:02:18.516: I/dalvikvm(21710): at java.lang.reflect.Method.invoke(Method.java:511) 09-15 14:02:18.516: I/dalvikvm(21710): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:980) 09-15 14:02:18.516: I/dalvikvm(21710): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747) 09-15 14:02:18.516: I/dalvikvm(21710): at dalvik.system.NativeStart.main(Native Method) 09-15 14:02:19.267: W/dalvikvm(21710): threadid=2: spin on suspend #9 threadid=1 (pcf=0) 09-15 14:02:19.267: I/dalvikvm(21710): "GC" daemon prio=5 tid=2 RUNNABLE 09-15 14:02:19.267: I/dalvikvm(21710): | group="system" sCount=0 dsCount=0 obj=0x419b4d68 self=0x124d8e8 09-15 14:02:19.267: I/dalvikvm(21710): | sysTid=21712 nice=0 sched=0/0 cgrp=default handle=19191584 09-15 14:02:19.267: I/dalvikvm(21710): | schedstat=( 0 0 0 ) utm=0 stm=0 core=0 09-15 14:02:19.267: I/dalvikvm(21710): at dalvik.system.NativeStart.run(Native Method) 09-15 14:02:19.267: I/dalvikvm(21710): "main" prio=5 tid=1 RUNNABLE JIT 09-15 14:02:19.267: I/dalvikvm(21710): | group="main" sCount=1 dsCount=0 obj=0x40c3fcd0 self=0x10c2c30 09-15 14:02:19.267: I/dalvikvm(21710): | sysTid=21710 nice=0 sched=0/0 cgrp=default handle=1074750856 09-15 14:02:19.267: I/dalvikvm(21710): | schedstat=( 0 0 0 ) utm=906 stm=5 core=0 09-15 14:02:19.267: I/dalvikvm(21710): at com.legends.app.CalendarActivity.onCreate(CalendarActivity.java:~122) 09-15 14:02:19.267: I/dalvikvm(21710): at android.app.Activity.performCreate(Activity.java:4470) 09-15 14:02:19.267: I/dalvikvm(21710): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1053) 09-15 14:02:19.267: I/dalvikvm(21710): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1934) 09-15 14:02:19.267: I/dalvikvm(21710): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995) 09-15 14:02:19.267: I/dalvikvm(21710): at android.app.ActivityThread.access$600(ActivityThread.java:128) 09-15 14:02:19.267: I/dalvikvm(21710): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161) 09-15 14:02:19.267: I/dalvikvm(21710): at android.os.Handler.dispatchMessage(Handler.java:99) 09-15 14:02:19.267: I/dalvikvm(21710): at android.os.Looper.loop(Looper.java:137) 09-15 14:02:19.267: I/dalvikvm(21710): at android.app.ActivityThread.main(ActivityThread.java:4514) 09-15 14:02:19.267: I/dalvikvm(21710): at java.lang.reflect.Method.invokeNative(Native Method) 09-15 14:02:19.267: I/dalvikvm(21710): at java.lang.reflect.Method.invoke(Method.java:511) 09-15 14:02:19.267: I/dalvikvm(21710): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:980) 09-15 14:02:19.267: I/dalvikvm(21710): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747) 09-15 14:02:19.267: I/dalvikvm(21710): at dalvik.system.NativeStart.main(Native Method) 09-15 14:02:20.018: W/dalvikvm(21710): threadid=2: spin on suspend #10 threadid=1 (pcf=0) 09-15 14:02:20.018: I/dalvikvm(21710): "GC" daemon prio=5 tid=2 RUNNABLE 09-15 14:02:20.018: I/dalvikvm(21710): | group="system" sCount=0 dsCount=0 obj=0x419b4d68 self=0x124d8e8 09-15 14:02:20.018: I/dalvikvm(21710): | sysTid=21712 nice=0 sched=0/0 cgrp=default handle=19191584 09-15 14:02:20.018: I/dalvikvm(21710): | schedstat=( 0 0 0 ) utm=0 stm=0 core=0 09-15 14:02:20.018: I/dalvikvm(21710): at dalvik.system.NativeStart.run(Native Method) 09-15 14:02:20.018: I/dalvikvm(21710): "main" prio=5 tid=1 RUNNABLE JIT 09-15 14:02:20.018: I/dalvikvm(21710): | group="main" sCount=1 dsCount=0 obj=0x40c3fcd0 self=0x10c2c30 09-15 14:02:20.018: I/dalvikvm(21710): | sysTid=21710 nice=0 sched=0/0 cgrp=default handle=1074750856 09-15 14:02:20.018: I/dalvikvm(21710): | schedstat=( 0 0 0 ) utm=979 stm=5 core=0 09-15 14:02:20.018: I/dalvikvm(21710): at com.legends.app.CalendarActivity.onCreate(CalendarActivity.java:~122) 09-15 14:02:20.018: I/dalvikvm(21710): at android.app.Activity.performCreate(Activity.java:4470) 09-15 14:02:20.018: I/dalvikvm(21710): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1053) 09-15 14:02:20.018: I/dalvikvm(21710): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1934) 09-15 14:02:20.018: I/dalvikvm(21710): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995) 09-15 14:02:20.018: I/dalvikvm(21710): at android.app.ActivityThread.access$600(ActivityThread.java:128) 09-15 14:02:20.018: I/dalvikvm(21710): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161) 09-15 14:02:20.018: I/dalvikvm(21710): at android.os.Handler.dispatchMessage(Handler.java:99) 09-15 14:02:20.018: I/dalvikvm(21710): at android.os.Looper.loop(Looper.java:137) 09-15 14:02:20.018: I/dalvikvm(21710): at android.app.ActivityThread.main(ActivityThread.java:4514) 09-15 14:02:20.018: I/dalvikvm(21710): at java.lang.reflect.Method.invokeNative(Native Method) 09-15 14:02:20.018: I/dalvikvm(21710): at java.lang.reflect.Method.invoke(Method.java:511) 09-15 14:02:20.018: I/dalvikvm(21710): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:980) 09-15 14:02:20.018: I/dalvikvm(21710): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747) 09-15 14:02:20.018: I/dalvikvm(21710): at dalvik.system.NativeStart.main(Native Method) 09-15 14:02:20.018: E/dalvikvm(21710): Fatal spin-on-suspend, dumping threads 09-15 14:02:20.018: I/dalvikvm(21710): DALVIK THREADS: 09-15 14:02:20.018: I/dalvikvm(21710): (mutexes: tll=2 tsl=1 tscl=0 ghl=1) 09-15 14:02:20.018: I/dalvikvm(21710): "main" prio=5 tid=1 RUNNABLE JIT 09-15 14:02:20.018: I/dalvikvm(21710): | group="main" sCount=1 dsCount=0 obj=0x40c3fcd0 self=0x10c2c30 09-15 14:02:20.018: I/dalvikvm(21710): | sysTid=21710 nice=0 sched=0/0 cgrp=default handle=1074750856 09-15 14:02:20.018: I/dalvikvm(21710): | schedstat=( 0 0 0 ) utm=979 stm=5 core=0 09-15 14:02:20.018: I/dalvikvm(21710): at com.legends.app.CalendarActivity.onCreate(CalendarActivity.java:~122) 09-15 14:02:20.018: I/dalvikvm(21710): at android.app.Activity.performCreate(Activity.java:4470) 09-15 14:02:20.018: I/dalvikvm(21710): at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1053) 09-15 14:02:20.018: I/dalvikvm(21710): at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1934) 09-15 14:02:20.018: I/dalvikvm(21710): at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1995) 09-15 14:02:20.018: I/dalvikvm(21710): at android.app.ActivityThread.access$600(ActivityThread.java:128) 09-15 14:02:20.018: I/dalvikvm(21710): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1161) 09-15 14:02:20.018: I/dalvikvm(21710): at android.os.Handler.dispatchMessage(Handler.java:99) 09-15 14:02:20.018: I/dalvikvm(21710): at android.os.Looper.loop(Looper.java:137) 09-15 14:02:20.018: I/dalvikvm(21710): at android.app.ActivityThread.main(ActivityThread.java:4514) 09-15 14:02:20.018: I/dalvikvm(21710): at java.lang.reflect.Method.invokeNative(Native Method) 09-15 14:02:20.018: I/dalvikvm(21710): at java.lang.reflect.Method.invoke(Method.java:511) 09-15 14:02:20.018: I/dalvikvm(21710): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:980) 09-15 14:02:20.018: I/dalvikvm(21710): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:747) 09-15 14:02:20.018: I/dalvikvm(21710): at dalvik.system.NativeStart.main(Native Method) 09-15 14:02:20.018: I/dalvikvm(21710): "AsyncTask #1" prio=5 tid=11 SUSPENDED 09-15 14:02:20.018: I/dalvikvm(21710): | group="main" sCount=1 dsCount=0 obj=0x41a23660 self=0x12d4758 09-15 14:02:20.018: I/dalvikvm(21710): | sysTid=21739 nice=10 sched=0/0 cgrp=bg_non_interactive handle=19348592 09-15 14:02:20.018: I/dalvikvm(21710): | schedstat=( 0 0 0 ) utm=18 stm=2 core=1 09-15 14:02:20.018: I/dalvikvm(21710): at java.lang.AbstractStringBuilder.append0(AbstractStringBuilder.java:~128) 09-15 14:02:20.018: I/dalvikvm(21710): at java.lang.StringBuilder.append(StringBuilder.java:271) 09-15 14:02:20.018: I/dalvikvm(21710): at java.io.BufferedReader.readLine(BufferedReader.java:417) 09-15 14:02:20.018: I/dalvikvm(21710): at com.legends.app.Events.doInBackground(Events.java:56) 09-15 14:02:20.018: I/dalvikvm(21710): at com.legends.app.Events.doInBackground(Events.java:1) 09-15 14:02:20.018: I/dalvikvm(21710): at android.os.AsyncTask$2.call(AsyncTask.java:264) 09-15 14:02:20.018: I/dalvikvm(21710): at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:305) 09-15 14:02:20.018: I/dalvikvm(21710): at java.util.concurrent.FutureTask.run(FutureTask.java:137) 09-15 14:02:20.018: I/dalvikvm(21710): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:208) 09-15 14:02:20.018: I/dalvikvm(21710): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1076) 09-15 14:02:20.018: I/dalvikvm(21710): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:569) 09-15 14:02:20.018: I/dalvikvm(21710): at java.lang.Thread.run(Thread.java:856) 09-15 14:02:20.018: I/dalvikvm(21710): "Binder Thread #2" prio=5 tid=10 SUSPENDED 09-15 14:02:20.018: I/dalvikvm(21710): | group="main" sCount=1 dsCount=0 obj=0x419b8f08 self=0x12dec18 09-15 14:02:20.018: I/dalvikvm(21710): | sysTid=21722 nice=0 sched=0/0 cgrp=default handle=18856864 09-15 14:02:20.018: I/dalvikvm(21710): | schedstat=( 0 0 0 ) utm=0 stm=0 core=0 09-15 14:02:20.018: I/dalvikvm(21710): at dalvik.system.NativeStart.run(Native Method) 09-15 14:02:20.018: I/dalvikvm(21710): "Binder Thread #1" prio=5 tid=9 SUSPENDED 09-15 14:02:20.018: I/dalvikvm(21710): | group="main" sCount=1 dsCount=0 obj=0x419b8540 self=0x12dcf78 09-15 14:02:20.018: I/dalvikvm(21710): | sysTid=21721 nice=0 sched=0/0 cgrp=default handle=19135504 09-15 14:02:20.018: I/dalvikvm(21710): | schedstat=( 0 0 0 ) utm=0 stm=0 core=0 09-15 14:02:20.018: I/dalvikvm(21710): at dalvik.system.NativeStart.run(Native Method) 09-15 14:02:20.018: I/dalvikvm(21710): "FinalizerWatchdogDaemon" daemon prio=5 tid=8 WAIT 09-15 14:02:20.018: I/dalvikvm(21710): | group="main" sCount=1 dsCount=0 obj=0x419b53d8 self=0x12e6520 09-15 14:02:20.018: I/dalvikvm(21710): | sysTid=21720 nice=0 sched=0/0 cgrp=default handle=18832048 09-15 14:02:20.018: I/dalvikvm(21710): | schedstat=( 0 0 0 ) utm=0 stm=0 core=1 09-15 14:02:20.018: I/dalvikvm(21710): at java.lang.Object.wait(Native Method) 09-15 14:02:20.018: I/dalvikvm(21710): - waiting on <0x40c474f0> (a java.lang.Daemons$FinalizerWatchdogDaemon) 09-15 14:02:20.018: I/dalvikvm(21710): at java.lang.Object.wait(Object.java:364) 09-15 14:02:20.018: I/dalvikvm(21710): at java.lang.Daemons$FinalizerWatchdogDaemon.run(Daemons.java:213) 09-15 14:02:20.018: I/dalvikvm(21710): at java.lang.Thread.run(Thread.java:856) 09-15 14:02:20.018: I/dalvikvm(21710): "FinalizerDaemon" daemon prio=5 tid=7 WAIT 09-15 14:02:20.018: I/dalvikvm(21710): | group="main" sCount=1 dsCount=0 obj=0x419b5280 self=0x12d3a48 09-15 14:02:20.018: I/dalvikvm(21710): | sysTid=21719 nice=0 sched=0/0 cgrp=default handle=18676648 09-15 14:02:20.018: I/dalvikvm(21710): | schedstat=( 0 0 0 ) utm=0 stm=0 core=0 09-15 14:02:20.018: I/dalvikvm(21710): at java.lang.Object.wait(Native Method) 09-15 14:02:20.018: I/dalvikvm(21710): - waiting on <0x40c355d0> (a java.lang.ref.ReferenceQueue) 09-15 14:02:20.018: I/dalvikvm(21710): at java.lang.Object.wait(Object.java:401) 09-15 14:02:20.018: I/dalvikvm(21710): at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:102) 09-15 14:02:20.018: I/dalvikvm(21710): at java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:73) 09-15 14:02:20.018: I/dalvikvm(21710): at java.lang.Daemons$FinalizerDaemon.run(Daemons.java:168) 09-15 14:02:20.018: I/dalvikvm(21710): at java.lang.Thread.run(Thread.java:856) 09-15 14:02:20.018: I/dalvikvm(21710): "ReferenceQueueDaemon" daemon prio=5 tid=6 WAIT 09-15 14:02:20.018: I/dalvikvm(21710): | group="main" sCount=1 dsCount=0 obj=0x419b5118 self=0x12e7bd8 09-15 14:02:20.018: I/dalvikvm(21710): | sysTid=21718 nice=0 sched=0/0 cgrp=default handle=18676448 09-15 14:02:20.018: I/dalvikvm(21710): | schedstat=( 0 0 0 ) utm=0 stm=0 core=0 09-15 14:02:20.018: I/dalvikvm(21710): at java.lang.Object.wait(Native Method) 09-15 14:02:20.018: I/dalvikvm(21710): - waiting on <0x40c354f8> 09-15 14:02:20.018: I/dalvikvm(21710): at java.lang.Object.wait(Object.java:364) 09-15 14:02:20.018: I/dalvikvm(21710): at java.lang.Daemons$ReferenceQueueDaemon.run(Daemons.java:128) 09-15 14:02:20.018: I/dalvikvm(21710): at java.lang.Thread.run(Thread.java:856) 09-15 14:02:20.018: I/dalvikvm(21710): "Compiler" daemon prio=5 tid=5 VMWAIT 09-15 14:02:20.018: I/dalvikvm(21710): | group="system" sCount=1 dsCount=0 obj=0x419b5028 self=0x12b2640 09-15 14:02:20.018: I/dalvikvm(21710): | sysTid=21717 nice=0 sched=0/0 cgrp=default handle=18856760 09-15 14:02:20.018: I/dalvikvm(21710): | schedstat=( 0 0 0 ) utm=2 stm=2 core=1 09-15 14:02:20.018: I/dalvikvm(21710): at dalvik.system.NativeStart.run(Native Method) 09-15 14:02:20.018: I/dalvikvm(21710): "JDWP" daemon prio=5 tid=4 VMWAIT 09-15 14:02:20.018: I/dalvikvm(21710): | group="system" sCount=1 dsCount=0 obj=0x419b4f40 self=0x1269cc0 09-15 14:02:20.018: I/dalvikvm(21710): | sysTid=21715 nice=0 sched=0/0 cgrp=default handle=19135712 09-15 14:02:20.018: I/dalvikvm(21710): | schedstat=( 0 0 0 ) utm=0 stm=0 core=1 09-15 14:02:20.018: I/dalvikvm(21710): at dalvik.system.NativeStart.run(Native Method) 09-15 14:02:20.018: I/dalvikvm(21710): "Signal Catcher" daemon prio=5 tid=3 VMWAIT 09-15 14:02:20.018: I/dalvikvm(21710): | group="system" sCount=1 dsCount=0 obj=0x419b4e48 self=0x12abed8 09-15 14:02:20.018: I/dalvikvm(21710): | sysTid=21713 nice=0 sched=0/0 cgrp=default handle=18712776 09-15 14:02:20.018: I/dalvikvm(21710): | schedstat=( 0 0 0 ) utm=0 stm=0 core=0 09-15 14:02:20.018: I/dalvikvm(21710): at dalvik.system.NativeStart.run(Native Method) 09-15 14:02:20.018: I/dalvikvm(21710): "GC" daemon prio=5 tid=2 RUNNABLE 09-15 14:02:20.018: I/dalvikvm(21710): | group="system" sCount=0 dsCount=0 obj=0x419b4d68 self=0x124d8e8 09-15 14:02:20.018: I/dalvikvm(21710): | sysTid=21712 nice=0 sched=0/0 cgrp=default handle=19191584 09-15 14:02:20.018: I/dalvikvm(21710): | schedstat=( 0 0 0 ) utm=0 stm=0 core=0 09-15 14:02:20.018: I/dalvikvm(21710): at dalvik.system.NativeStart.run(Native Method) 09-15 14:02:20.018: E/dalvikvm(21710): threadid=2: stuck on threadid=1, giving up 09-15 14:02:20.018: D/dalvikvm(21710): threadid=2: sending two SIGSTKFLTs to threadid=1 (tid=21710) to cause debuggerd dump 09-15 14:02:20.018: D/dalvikvm(21710): NOTE: pthread_kill #1 failed: Operation not permitted 09-15 14:02:22.010: D/dalvikvm(21710): NOTE: pthread_kill #2 failed: Operation not permitted 09-15 14:02:22.010: D/dalvikvm(21710): Sent, pausing to let debuggerd run 09-15 14:02:30.018: D/dalvikvm(21710): Continuing 09-15 14:02:30.018: E/dalvikvm(21710): VM aborting 

И здесь я называю это основной деятельностью. Это также два отдельных файла, я не знаю, насколько это актуально, но может быть, я не знаю.

  Events db = new Events(); db.execute(); while (db.result == null){ continue;} result = db.result; 

Solutions Collecting From Web of "Fatal Spin-On-Suspend / Stuck on ThreadID"

Я подумал об этом после следующего дня игры. Это из-за этих строк в не-AsyncTask:

 while (db.result == null) { continue; } 

Потребовалось это как «вы пойманы навсегда в замкнутом цикле, и поэтому программа должна была потерпеть крах», когда на самом деле было просто время, чтобы прочитать события. Однако без этого он просто будет двигаться без полной загрузки событий, создав исключение NullPointerException, когда он попытается использовать этот массив. Вместо этого я сделал это:

 while (db.result == null){ try { Thread.sleep(100); } catch (InterruptedException e) { // TODO Auto-generated catch block e.printStackTrace(); } continue; } 

Сон, похоже, отправляет обратно в приложение, что я все еще там, просто жду данных, чтобы продолжить. Либо это, либо это замедляет количество раз, когда я иду через цикл while. Не уверен, что он делает, но в любом случае он решает проблему.

Я пошел об этом несколько иначе:

Сначала я установил поле в классе AsyncTask

 private boolean taskDone = false; 

Затем, после кода doInBackground (или в postExecute):

 this.taskDone = true; 

Наконец, добавьте метод AsyncTask:

 public boolean isTaskDone() { return taskDone; } 

Теперь вы можете использовать isTaskDone в качестве аргумента в цикле while:

 while (!isTaskDone()) { // wait for task } 

Просто мой способ сделать это, я уверен, что есть еще много