neworld
neworld

Reputation: 7793

GetBufferLock timed out for thread

I am developing on Android Samsung galaxy TAB 10.1. After I official updated to 4.0.4 version often get error:

11-01 17:04:35.382: E/gralloc(11657): GetBufferLock timed out for thread 11657 buffer 0x55 usage 0x33 LockState 1

and device immediate restarts. This error appear totally random and if I am debugging my own applications.

Any suggestion?

P.S.

My only one infinite paint loop:

public void run() {
    Canvas canvas = null;

    while (true) {
        try {
            Thread.sleep(50);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }

        try {
            synchronized (lock) {
                if (!invalidated)
                    continue;
            }

            canvas = mHolder.lockCanvas();

            synchronized (mHolder) {
                onDraw(canvas);
            }

            synchronized (lock) {
                invalidated = false;
            }
        } finally {
            if (canvas != null) {
                mHolder.unlockCanvasAndPost(canvas);
                canvas = null;
            }
        }

        synchronized (lock) {
            if (painter == null)
                break;
        }
    }
}

Upvotes: 7

Views: 550

Answers (2)

Guian
Guian

Reputation: 4688

I guess something is wrong this the GPU memory, are you doing some heavy graphic display when this error occurs ?

if not... maybe another app is.

It's worth checking for app with heavy GPU consumption ( Probably an heavy live wallpaper ? ) and remove it. then a reboot should fix this.

also just be aware that you should never ever write :

while (true) {
}

at least add a running flag :

while(running){
}

so you can set running to false on application stop.

Upvotes: 1

peeyush
peeyush

Reputation: 2921

Looks like a block which needed to be accessed by other thread is used by infinitely by your application. Are you running infinite loop inside your paint method ?

Upvotes: 0

Related Questions