Interpret Logcat entry: threadid=8: still suspended after undo (sc=1 dc=1 s=Y)

淺唱寂寞╮ 提交于 2019-12-05 07:35:43

The message comes from dvmSuspendSelf(), which threads call when the debugger (via the JDWP thread) has asked them to suspend.

The way it's supposed to work is (where "we" are a thread):

  • JDWP asks us to suspend
  • we tell it we've suspended and go to sleep
  • eventually, debugger wakes us up and we resume

The message is logged when the condition variable the VM is waiting on signals, but for some reason we're still marked as suspended. The code notes:

/*
 * The condition was signaled but we're still suspended.  This
 * can happen if the debugger lets go while a SIGQUIT thread
 * dump event is pending (assuming SignalCatcher was resumed for
 * just long enough to try to grab the thread-suspend lock).
 */

The expectation in this case is that we got woken up unexpectedly when a signal arrived (e.g. system_server thinks there's an ANR because the main thread isn't responding because the debugger has suspended it), and if we loop around again the debugger will get a chance to clean us up and set us on our way.

The log message is printing the values of self->suspendCount (how many times have we been told to suspend ourselves), self->dbgSuspendCount (how many of those suspend requests came from the debugger, so we can "undo" all those if the debugger disconnects), and the value of the self->isSuspended boolean.

Note the "s=Y" flag disappeared in gingerbread -- the way thread suspension works was changed.

Deepak Bala

This thread is old but this answer should provide useful for users stumbling across this question months later.

Quoting a user's reply on a google group thread

There's a weird interaction between the VM and your debugger. The thread suspended itself and then waited to be woken. However, when it was woken the thread was still marked as being suspended (s=1) by the debugger (d=1).

I've come across this on the emulator and on the phone itself. If the debugger is disconnected from the device (be it emulated or real), this error condition is reset. I have found no other way of escaping the problem.

Another SO answer claims this is due to debug breakpoints being out of sync - DexFile.class error in eclipse

You can try that too.

HTH

Me too come across the problem. Simply just because after I started a new Thread(), I tried to access the stuff in the thread that had already been suspended. Removed that code, and the problem is resolved.

HTH

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!