Reputation: 11
My Android App crash on my second post on firebase server. in logcat it shows following:
08-14 20:01:55.775 2038-2047/com.spiralaxis.citiconnect 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:184)
at com.android.org.conscrypt.OpenSSLSocketImpl.startHandshake(OpenSSLSocketImpl.java:287)
at com.android.org.conscrypt.OpenSSLSocketImpl.waitForHandshake(OpenSSLSocketImpl.java:623)
at com.android.org.conscrypt.OpenSSLSocketImpl.getSession(OpenSSLSocketImpl.java:787)
at com.firebase.tubesock.WebSocket.verifyHost(WebSocket.java:333)
at com.firebase.tubesock.WebSocket.createSocket(WebSocket.java:319)
at com.firebase.tubesock.WebSocket.run(WebSocket.java:117)
Upvotes: 1
Views: 410
Reputation: 1
(firebase dev here) We have a fix that will appear in the next release of our Android Firebase client. Until that happens, if you use Strict Mode, please use penaltylog instead of penaltydeath and ignore the error.
Upvotes: 0
Reputation: 15821
Fully agree with chiastic-security's answer.
and add from himself : Each resources in every native-wrapped language(also in Java too) you need to close opened resourses that no need more to use.
In Android devlopment in such cases you need to check for closing resources :
The error
A resource was acquired at attached stack trace but never released. See java.io.Closeable for information on avoiding resource leaks.
means (possibly in your case) that you doesn't closed stream which read data, after use it.
You need get the response stream, read it completely and close it (even if the response code is not OK) - i mean catch-finaly block.
Upvotes: 0
Reputation: 16309
Firebase dev here. We'll take a look at this and try to get it fixed in a future release of Firebase. For now, I guess you'll need to disable StrictMode.
Upvotes: 2
Reputation: 20520
Because Android runs on very resource-constrained devices, it's particularly important to ensure that resources aren't wasted. Java is pretty good at making sure resources are freed as soon as they're not needed, and for many things it does this automatically, but there are some things for which that can't be reliably done.
What's been picked up here in the logcat is that you're grabbing some kind of resource, but never freeing it. It looks as though it's a web socket that you're grabbing. Are you opening a network connection but not closing it again when you've finished?
Upvotes: 1