mattprecious / telescope

A simple tool to allow easy bug report capturing within your app.
Apache License 2.0
1.18k stars 116 forks source link

Resource acquired was not closed #42

Closed AlecKazakova closed 8 years ago

AlecKazakova commented 8 years ago
StrictMode  E  A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding re
                            source leaks.
                         E  java.lang.Throwable: Explicit termination method 'release' not called
                         E      at dalvik.system.CloseGuard.open(CloseGuard.java:184)
                         E      at android.view.Surface.setNativeObjectLocked(Surface.java:460)
                         E      at android.view.Surface.<init>(Surface.java:152)
                         E      at android.media.ImageReader.nativeGetSurface(Native Method)
                         E      at android.media.ImageReader.<init>(ImageReader.java:130)
                         E      at android.media.ImageReader.newInstance(ImageReader.java:100)
                         E      at com.mattprecious.telescope.TelescopeLayout$6.run(TelescopeLayout.java:615)
                         E      at android.os.Handler.handleCallback(Handler.java:739)
                         E      at android.os.Handler.dispatchMessage(Handler.java:95)
                         E      at android.os.Looper.loop(Looper.java:135)
                         E      at android.app.ActivityThread.main(ActivityThread.java:5254)
                         E      at java.lang.reflect.Method.invoke(Native Method)
                         E      at java.lang.reflect.Method.invoke(Method.java:372)
                         E      at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
                         E      at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)

looks like this is caused by imageReader not being closed at https://github.com/mattprecious/telescope/blob/master/telescope/src/main/java/com/mattprecious/telescope/TelescopeLayout.java#L616

found via strictmode

mattprecious commented 8 years ago

I can repro this on the Genymotion 5.1.0 image and the entire SystemUI crashes. I think the app is being killed due to some other exception before it gets a chance to close the reader. I'm curious to see if this occurs on anything other than Genymotion...

mattprecious commented 8 years ago

Blaming this on Genymotion. Let me know if you see this on a different image or a real device.