IllegalArgumentException Surface.nativeLockCanvas , Choreographer, BufferQueue
Asked Answered
B

1

6

I have a complex application that creates multiple Bitmap objets and uses them to create BitmapDrawables. I know this might be a tough question to answer, but any help in pointing me in the right direction would be much appreciated. I have run tests on memory allocation, and have come up mostly empty handed. ... Any ideas on what could be causing this?

LOG:

04-29 12:48:00.442: E/BufferQueue(177): [com.example.app/com.example.app.Activity_One] queueBuffer: fence is NULL
04-29 12:48:00.442: E/Surface(2154): queueBuffer: error queuing buffer to SurfaceTexture, -22
04-29 12:48:00.442: W/Adreno-EGLSUB(2154): <SwapBuffers:1374>: failed to queueBuffer
04-29 12:48:00.442: W/Adreno-EGL(2154): <qeglDrvAPI_eglSwapBuffers:3654>: EGL_BAD_SURFACE
04-29 12:48:04.486: W/Adreno-EGLSUB(2154): <DequeueBuffer:606>: dequeue native buffer fail: Unknown error 2147483646, buffer=0x0, handle=0x0
04-29 12:48:04.486: E/BufferQueue(177): [com.example.app/com.example.app.Activity_One] dequeueBuffer: can't dequeue multiple buffers without setting the buffer count
04-29 12:48:04.486: W/Adreno-EGLSUB(2154): <DequeueBuffer:606>: dequeue native buffer fail: Invalid argument, buffer=0x0, handle=0x0
04-29 12:48:04.486: W/Adreno-ES20(2154): <gl2_surface_swap:43>: GL_OUT_OF_MEMORY
04-29 12:48:04.486: W/Adreno-EGL(2154): <qeglDrvAPI_eglSwapBuffers:3597>: EGL_BAD_SURFACE
04-29 12:48:04.486: W/HardwareRenderer(2154): EGL error: EGL_BAD_SURFACE
04-29 12:48:04.506: W/HardwareRenderer(2154): Mountain View, we've had a problem here. Switching back to software rendering.
04-29 12:48:08.440: E/Surface(2154): dequeueBuffer failed (Unknown error 2147483646)
04-29 12:48:08.480: E/ViewRootImpl(2154): Could not lock surface
04-29 12:48:08.480: E/ViewRootImpl(2154): java.lang.IllegalArgumentException
04-29 12:48:08.480: E/ViewRootImpl(2154):   at android.view.Surface.nativeLockCanvas(Native Method)
04-29 12:48:08.480: E/ViewRootImpl(2154):   at android.view.Surface.lockCanvas(Surface.java:243)
04-29 12:48:08.480: E/ViewRootImpl(2154):   at android.view.ViewRootImpl.drawSoftware(ViewRootImpl.java:2435)
04-29 12:48:08.480: E/ViewRootImpl(2154):   at android.view.ViewRootImpl.draw(ViewRootImpl.java:2409)
04-29 12:48:08.480: E/ViewRootImpl(2154):   at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2253)
04-29 12:48:08.480: E/ViewRootImpl(2154):   at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1883)
04-29 12:48:08.480: E/ViewRootImpl(2154):   at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1000)
04-29 12:48:08.480: E/ViewRootImpl(2154):   at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5670)
04-29 12:48:08.480: E/ViewRootImpl(2154):   at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
04-29 12:48:08.480: E/ViewRootImpl(2154):   at android.view.Choreographer.doCallbacks(Choreographer.java:574)
04-29 12:48:08.480: E/ViewRootImpl(2154):   at android.view.Choreographer.doFrame(Choreographer.java:544)
04-29 12:48:08.480: E/ViewRootImpl(2154):   at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
04-29 12:48:08.480: E/ViewRootImpl(2154):   at android.os.Handler.handleCallback(Handler.java:733)
04-29 12:48:08.480: E/ViewRootImpl(2154):   at android.os.Handler.dispatchMessage(Handler.java:95)
04-29 12:48:08.480: E/ViewRootImpl(2154):   at android.os.Looper.loop(Looper.java:136)
04-29 12:48:08.480: E/ViewRootImpl(2154):   at android.app.ActivityThread.main(ActivityThread.java:5017)
04-29 12:48:08.480: E/ViewRootImpl(2154):   at java.lang.reflect.Method.invokeNative(Native Method)
04-29 12:48:08.480: E/ViewRootImpl(2154):   at java.lang.reflect.Method.invoke(Method.java:515)
04-29 12:48:08.480: E/ViewRootImpl(2154):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
04-29 12:48:08.480: E/ViewRootImpl(2154):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
04-29 12:48:08.480: E/ViewRootImpl(2154):   at dalvik.system.NativeStart.main(Native Method)
04-29 12:48:09.441: E/BufferQueue(177): [com.example.app/com.example.app.Activity_One] dequeueBuffer: can't dequeue multiple buffers without setting the buffer count
04-29 12:48:09.441: E/Surface(2154): dequeueBuffer failed (Invalid argument)
04-29 12:48:09.461: E/ViewRootImpl(2154): Could not lock surface
04-29 12:48:09.461: E/ViewRootImpl(2154): java.lang.IllegalArgumentException
04-29 12:48:09.461: E/ViewRootImpl(2154):   at android.view.Surface.nativeLockCanvas(Native Method)
04-29 12:48:09.461: E/ViewRootImpl(2154):   at android.view.Surface.lockCanvas(Surface.java:243)
04-29 12:48:09.461: E/ViewRootImpl(2154):   at android.view.ViewRootImpl.drawSoftware(ViewRootImpl.java:2435)
04-29 12:48:09.461: E/ViewRootImpl(2154):   at android.view.ViewRootImpl.draw(ViewRootImpl.java:2409)
04-29 12:48:09.461: E/ViewRootImpl(2154):   at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:2253)
04-29 12:48:09.461: E/ViewRootImpl(2154):   at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1883)
04-29 12:48:09.461: E/ViewRootImpl(2154):   at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1000)
04-29 12:48:09.461: E/ViewRootImpl(2154):   at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5670)
04-29 12:48:09.461: E/ViewRootImpl(2154):   at android.view.Choreographer$CallbackRecord.run(Choreographer.java:761)
04-29 12:48:09.461: E/ViewRootImpl(2154):   at android.view.Choreographer.doCallbacks(Choreographer.java:574)
04-29 12:48:09.461: E/ViewRootImpl(2154):   at android.view.Choreographer.doFrame(Choreographer.java:544)
04-29 12:48:09.461: E/ViewRootImpl(2154):   at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:747)
04-29 12:48:09.461: E/ViewRootImpl(2154):   at android.os.Handler.handleCallback(Handler.java:733)
04-29 12:48:09.461: E/ViewRootImpl(2154):   at android.os.Handler.dispatchMessage(Handler.java:95)
04-29 12:48:09.461: E/ViewRootImpl(2154):   at android.os.Looper.loop(Looper.java:136)
04-29 12:48:09.461: E/ViewRootImpl(2154):   at android.app.ActivityThread.main(ActivityThread.java:5017)
04-29 12:48:09.461: E/ViewRootImpl(2154):   at java.lang.reflect.Method.invokeNative(Native Method)
04-29 12:48:09.461: E/ViewRootImpl(2154):   at java.lang.reflect.Method.invoke(Method.java:515)
04-29 12:48:09.461: E/ViewRootImpl(2154):   at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:779)
04-29 12:48:09.461: E/ViewRootImpl(2154):   at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:595)
04-29 12:48:09.461: E/ViewRootImpl(2154):   at dalvik.system.NativeStart.main(Native Method)
04-29 12:48:09.761: E/BufferQueue(177): [com.example.app/com.example.app.Activity_One] dequeueBuffer: can't dequeue multiple buffers without setting the buffer count
…
Bream answered 29/4, 2014 at 16:59 Comment(7)
You're not running out of memory. The failure is in the first couple of log lines -- the BufferQueue is getting in a bad state, rejecting attempts to queue a buffer. So the buffer is still officially "checked out", and when lockCanvas() tries to dequeue another one the BufferQueue is saying no. It looks like the root cause is a NULL fence being passed to queueBuffer(). Not sure what would cause that.Standoffish
Thanks @Standoffish ... Here's where the null fence might be, I'm still working on hunting this down.Bream
I'm wondering if it has something to do with the device or version of Android I am using. I switched devices and android versions, and haven't been able to reproduce the problem.Bream
That is certainly possible. What device / version shows the problem?Standoffish
@fadden, it's a Asus Nexus 7, running Android 4.4.2., Kit-KatBream
I'm having the same issue, also N7 (2013) Android 4.4.2. User interface is not anything special.Attested
Interesting, I am also having a similar issue on an Android 4.4.2 device (Asus Nexus 7). It happens roughly (or maybe exactly) 5 minutes after I launch the app.Krefeld
W
1

I was having the same error. For me the problem was that I was not closing the file (file.close()) in JNI code.

Wroughtup answered 29/8, 2014 at 21:30 Comment(1)
What are u doing with the file in JNI ? Since, I am getting the same exception while using Jni codeLudwigg

© 2022 - 2024 — McMap. All rights reserved.