我遇到了一个问题,即线程在java.io.PrintStream.println被阻止。 有没有人知道可能导致什么? 该线程正在执行System.out.println但被阻止。
Below is the trace of the blocked thread:
"Binder_1" prio=5 tid=9 MONITOR
| group="main" sCount=1 dsCount=0 obj=0x4197e810 self=0x71c16fe8
| sysTid=2872 nice=0 sched=0/0 cgrp=apps handle=1879251944
| state=S schedstat=( 28753697 30516930 198 ) utm=1 stm=1 core=3
at java.io.PrintStream.println(PrintStream.java:~525)
- waiting to lock <0x418e8458> (a java.io.PrintStream) held by tid=1
(main)
at com.android.commands.monkey.Monkey$ActivityController.activityStarting(Monkey.java:292)
at android.app.IActivityController$Stub.onTransact(IActivityController.java:62)
at android.os.Binder.execTransact(Binder.java:404)
at dalvik.system.NativeStart.run(Native Method)
关于tid = 1(main)的线程,下面是跟踪:
"main" prio=5 tid=1 MONITOR
| group="main" sCount=1 dsCount=0 obj=0x4163ae58 self=0x4155a820
| sysTid=957 nice=-2 sched=0/0 cgrp=apps handle=1074270548
| state=S schedstat=( 152811485739 161565519532 434804 ) utm=10108 stm=5173 core=3
at com.android.server.am.ActivityManagerService.broadcastIntent(ActivityManagerService.java:~14181)
- waiting to lock <0x41f6a218> (a com.android.server.am.ActivityManagerService) held by tid=48 (Binder_5)
at android.app.ActivityManagerNative.broadcastStickyIntent(ActivityManagerNative.java:97)
at com.android.server.BatteryService$10.run(BatteryService.java:786)
at android.os.Handler.handleCallback(Handler.java:733)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:136)
at com.android.server.ServerThread.initAndLoop(SystemServer.java:1168)
at com.android.server.SystemServer.main(SystemServer.java:1265)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:515)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:888)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:697)
at dalvik.system.NativeStart.main(Native Method)
我不认为主线是占据了主线 的System.out.println 因为它也被封锁但没有做 的System.out.println
"Binder_5" prio=5 tid=48 NATIVE
| group="main" sCount=1 dsCount=0 obj=0x427f6f00 self=0x76ddbc60
| sysTid=1552 nice=0 sched=0/0 cgrp=apps handle=1994241064
| state=S schedstat=( 221394418709 101632316635 622311 ) utm=17405 stm=4734 core=3
#00 pc 000206e4 /system/lib/libc.so (__ioctl+8)
#01 pc 0002cf4b /system/lib/libc.so (ioctl+14)
#02 pc 0001d3e9 /system/lib/libbinder.so (android::IPCThreadState::talkWithDriver(bool)+140)
#03 pc 0001d8d3 /system/lib/libbinder.so (android::IPCThreadState::waitForResponse(android::Parcel*, int*)+42)
#04 pc 0001dadb /system/lib/libbinder.so (android::IPCThreadState::transact(int, unsigned int, android::Parcel const&, android::Parcel*, unsigned int)+118)
#05 pc 0001978d /system/lib/libbinder.so (android::BpBinder::transact(unsigned int, android::Parcel const&, android::Parcel*, unsigned int)+30)
#06 pc 000736c5 /system/lib/libandroid_runtime.so
#07 pc 000203cc /system/lib/libdvm.so (dvmPlatformInvoke+112)
#08 pc 00051097 /system/lib/libdvm.so (dvmCallJNIMethod(unsigned int const*, JValue*, Method const*, Thread*)+398)
#09 pc 00029860 /system/lib/libdvm.so
#10 pc 00030d34 /system/lib/libdvm.so (dvmMterpStd(Thread*)+76)
#11 pc 0002e3cc /system/lib/libdvm.so (dvmInterpret(Thread*, Method const*, JValue*)+184)
#12 pc 000634fd /system/lib/libdvm.so (dvmCallMethodV(Thread*, Method const*, Object*, bool, JValue*, std::__va_list)+336)
#13 pc 0004fdfd /system/lib/libdvm.so
#14 pc 0006dea3 /system/lib/libandroid_runtime.so
#15 pc 00073413 /system/lib/libandroid_runtime.so
#16 pc 00019221 /system/lib/libbinder.so (android::BBinder::transact(unsigned int, android::Parcel const&, android::Parcel*, unsigned int)+60)
#17 pc 0001d795 /system/lib/libbinder.so (android::IPCThreadState::executeCommand(int)+508)
#18 pc 0001db13 /system/lib/libbinder.so (android::IPCThreadState::getAndExecuteCommand()+38)
#19 pc 0001db89 /system/lib/libbinder.so (android::IPCThreadState::joinThreadPool(bool)+48)
#20 pc 00021995 /system/lib/libbinder.so
#21 pc 0000ea5d /system/lib/libutils.so (android::Thread::_threadLoop(void*)+216)
#22 pc 0004e131 /system/lib/libandroid_runtime.so (android::AndroidRuntime::javaThreadShell(void*)+68)
#23 pc 0000e58f /system/lib/libutils.so
#24 pc 0000d230 /system/lib/libc.so (__thread_entry+72)
#25 pc 0000d3c8 /system/lib/libc.so (pthread_create+240)
at android.os.BinderProxy.transact(Native Method)
at android.app.IActivityController$Stub$Proxy.activityStarting(IActivityController.java:172)
at com.android.server.am.ActivityStackSupervisor.startActivityLocked(ActivityStackSupervisor.java:1223)
at com.android.server.am.ActivityStackSupervisor.startActivityMayWait(ActivityStackSupervisor.java:764)
at com.android.server.am.ActivityManagerService.startActivityAsUser(ActivityManagerService.java:3226)
at com.android.server.am.ActivityManagerService.startActivity(ActivityManagerService.java:3204)
at android.app.ActivityManagerNative.onTransact(ActivityManagerNative.java:136)
at com.android.server.am.ActivityManagerService.onTransact(ActivityManagerService.java:2160)
at android.os.Binder.execTransact(Binder.java:404)
at dalvik.system.NativeStart.run(Native Method)