Sunday, April 22, 2012

Nexus One / Android "CPU may be pegged” bug


I'm writing a graphically intense game for the Nexus One, using the NDK (revision 4) and OpenGL ES 2.0. We're really pushing the hardware here, and for the most part it works well, except every once in a while I get a serious crash with this log message:



W/SharedBufferStack( 398): waitForCondition(LockCondition) timed out (identity=9, status=0). CPU may be pegged. trying again.



The entire system locks up, repeats this message over and over, and will either restart after a couple minutes or we have to reboot it manually. We're using Android OS 2.1, update 1.



I know a few other people out there have seen this bug, sometimes in relation to audio. In my case it's caused by the SharedBufferStack, so I'm guessing it's an OpenGL issue. Has anyone encountered this, and better yet fixed it? Or does anyone know what's going on with the SharedBufferStack to help me narrow things down?



Thanks in advance!



~ Kim


Source: Tips4all

3 comments:

  1. I don't believe such error can occur in audio code, SharedBufferStack is only used in Surface libraries. Most probably this is a bug in EGL swapBuffers or SurfaceFlinger implementation, and you should file it to the bug tracker.

    ReplyDelete
  2. I got CPU may be pegged messages on LogCat because I had a ArrayBlockingQueue in my code. If you have any blocking queue (as seems to be the case with audio buffers), be sure to BlockingQueue.put() only if you have timing control enough to properly BlockingQueue.take() elements to make room for it. Or else, have a look on using BlockingQueue.offer().

    ReplyDelete
  3. The waitForCondition() causes the lockup (system-freeze).
    But it is not the root-cause. This seems to be a issue with

    The audio-framework (ur game has sounds?)
    -or-
    The GL rendering-subsystem.

    Any "CPU-pegged" messages in the log?
    You might want to take a look at this:
    http://soledadpenades.com/2009/08/25/is-the-cpu-pegged-and-friends/

    GoodLUCK!
    CVS

    ReplyDelete