-
Notifications
You must be signed in to change notification settings - Fork 6.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
StrictMode warning about an unclosed resourse #474
Comments
By your reference, it looks like you're using the OkHttp integration library? |
Correct. okhttp-urlconnection 2.3.0 |
Unlike the referenced OkHttp issue, as far as I can tell, we do in fact call close on the response body. Close is called in cleanup here: https://github.com/bumptech/glide/blob/3.0/integration/okhttp/src/main/java/com/bumptech/glide/integration/okhttp/OkHttpStreamFetcher.java#L60 And cleanup is called in a finally block here: https://github.com/bumptech/glide/blob/3.0/library/src/main/java/com/bumptech/glide/load/engine/DecodeJob.java#L179 You can also see that cleanup is delegated in the wrapping ImageVideoModelLoader here: If you can reproduce this reliably, do you maybe want to put in a break point and verify whether or not the response body is in fact being closed? Also do you still see the same exception if you use OkHttp 2.2.0 (the version Glide's integration library is compiled against, see: https://github.com/bumptech/glide/blob/3.0/gradle.properties#L21)? |
Let me know if you get the chance to try anything I mentioned in my last comment. |
Same exception with 2.2.0 and 2.4.0 A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
java.lang.Throwable: Explicit termination method 'close' not called
at dalvik.system.CloseGuard.open(CloseGuard.java:184)
at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:278)
at com.squareup.okhttp.Connection.upgradeToTls(Connection.java:241)
at com.squareup.okhttp.Connection.connect(Connection.java:158)
at com.squareup.okhttp.Connection.connectAndSetOwner(Connection.java:174)
at com.squareup.okhttp.OkHttpClient$1.connectAndSetOwner(OkHttpClient.java:120)
at com.squareup.okhttp.internal.http.RouteSelector.next(RouteSelector.java:131)
at com.squareup.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:312)
at com.squareup.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:235)
at com.squareup.okhttp.Call.getResponse(Call.java:262)
at com.squareup.okhttp.Call$ApplicationInterceptorChain.proceed(Call.java:219)
at com.squareup.okhttp.Call.getResponseWithInterceptorChain(Call.java:192)
at com.squareup.okhttp.Call.execute(Call.java:79)
at com.bumptech.glide.integration.okhttp.OkHttpStreamFetcher.loadData(OkHttpStreamFetcher.java:42)
at com.bumptech.glide.integration.okhttp.OkHttpStreamFetcher.loadData(OkHttpStreamFetcher.java:19)
at com.bumptech.glide.load.model.ImageVideoModelLoader$ImageVideoFetcher.loadData(ImageVideoModelLoader.java:70)
at com.bumptech.glide.load.model.ImageVideoModelLoader$ImageVideoFetcher.loadData(ImageVideoModelLoader.java:53)
at com.bumptech.glide.load.engine.DecodeJob.decodeSource(DecodeJob.java:170)
at com.bumptech.glide.load.engine.DecodeJob.decodeFromSource(DecodeJob.java:128)
at com.bumptech.glide.load.engine.EngineRunnable.decodeFromSource(EngineRunnable.java:122)
at com.bumptech.glide.load.engine.EngineRunnable.decode(EngineRunnable.java:101)
at com.bumptech.glide.load.engine.EngineRunnable.run(EngineRunnable.java:58)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:422)
at java.util.concurrent.FutureTask.run(FutureTask.java:237)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
at java.lang.Thread.run(Thread.java:841)
at com.bumptech.glide.load.engine.executor.FifoPriorityThreadPoolExecutor$DefaultThreadFactory$1.run(FifoPriorityThreadPoolExecutor.java:118) |
@seroperson there was no code change, the original OP didn't help out other than stating there's an issue. Without proper repoduction steps it's hard to fix it, see #474 (comment) where Sam shows in code where the actual closes happen and asks do debug whether those are correctly called. Please investigate more if you can and report back on those points. |
I can't reproduce it because it throws randomly. Maybe I will add some details later. |
[extracted from https://github.com//pull/61]
Getting a StrictMode warning on the latest Glide 3.6.0 .(see square/okhttp#1053)
The text was updated successfully, but these errors were encountered: