question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Strict Mode Error: Explicit termination method 'close' not called

See original GitHub issue

Wounder if anyone else has seen this strict mode violation, it could be my own code but if it is I can’t see how.

E/StrictMode: 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:180)
                                                                          at java.io.FileInputStream.<init>(FileInputStream.java:78)
                                                                          at okio.Okio.source(Okio.java:163)
                                                                          at okhttp3.internal.io.FileSystem$1.source(FileSystem.java:44)
                                                                          at okhttp3.internal.DiskLruCache$Entry.snapshot(DiskLruCache.java:1004)
                                                                          at okhttp3.internal.DiskLruCache.get(DiskLruCache.java:431)
                                                                          at okhttp3.Cache.get(Cache.java:193)
                                                                          at okhttp3.Cache$1.get(Cache.java:143)
                                                                          at okhttp3.internal.http.HttpEngine.sendRequest(HttpEngine.java:198)
                                                                          at okhttp3.RealCall.getResponse(RealCall.java:240)
                                                                          at okhttp3.RealCall$ApplicationInterceptorChain.proceed(RealCall.java:198)
                                                                          at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:160)
                                                                          at okhttp3.RealCall.access$100(RealCall.java:30)
                                                                          at okhttp3.RealCall$AsyncCall.execute(RealCall.java:127)
                                                                          at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
                                                                          at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
                                                                          at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
                                                                          at java.lang.Thread.run(Thread.java:818)

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:20 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
evgentsetcommented, Nov 22, 2018

I have similar issue with v 3.11.0, see in logs this error:

E/StrictMode: 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:180) at com.android.org.conscrypt.Platform.closeGuardOpen(Platform.java:282) at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:316) at com.android.okhttp.Connection.connectTls(Connection.java:235) at com.android.okhttp.Connection.connectSocket(Connection.java:199) at com.android.okhttp.Connection.connect(Connection.java:172) at com.android.okhttp.Connection.connectAndSetOwner(Connection.java:367) at com.android.okhttp.OkHttpClient$1.connectAndSetOwner(OkHttpClient.java:130) at com.android.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:329) at com.android.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:246) at com.android.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:457) at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:405) at com.android.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:521) at com.android.okhttp.internal.huc.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:105) at com.android.okhttp.internal.huc.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java) at android.media.MediaHTTPConnection.seekTo(MediaHTTPConnection.java:211) at android.media.MediaHTTPConnection.readAt(MediaHTTPConnection.java:326) at android.media.MediaHTTPConnection.native_readAt(Native Method) at android.media.MediaHTTPConnection.readAt(MediaHTTPConnection.java:315) at android.media.IMediaHTTPConnection$Stub.onTransact(IMediaHTTPConnection.java:72) at android.os.Binder.execTransact(Binder.java:565)

I’m not sure, but everything seems to be working.

1reaction
swankjessecommented, Aug 31, 2016

Please don’t call cache.close() until you’re completely done with your response cache.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Explicit termination method 'end' not called - Stack Overflow
I found somebody complaining of seeing the same StrictMode failure when using Google AdMob SDK (https://groups.google.com/forum/?fromgroups=#! ...
Read more >
java.lang.Throwable: Explicit termination method 'close' not ...
E/StrictMode(10704): A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
Read more >
Strict Mode “A resource was acquired at attached stack trace ...
Im getting the following exception on strict mode when starting my app. ... Throwable: Explicit termination method 'close' not called
Read more >
Android Strict Mode complaining HttpURLConnection is never ...
I'm seeing the same Throwable: Explicit termination method 'end' not called when trying to use HttpURLConnection.getResponseCode in my own code, ...
Read more >
Explicit termination method 'close' not called - F-Droid Forum
I'm with a issue when I start my application 11-13 10:05:49.411 22031-22043/br.com.marketPlace E/StrictMode: A resource was acquired at ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found