Skip to content

StrictMode: Not closing ApacheHttpClient Gzip Stream #38

@chrisjenx

Description

@chrisjenx

When calling network requests, it seems that you don't terminate your InputStreams safely leading to resource leaking.

Android 5.1.0,
Genemotion emulator
parse-android:1.10.1.

Personally I would move to using something like OKHttp out of choice as it saves effort on these issues which have already been solved.

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 'end' not called
            at dalvik.system.CloseGuard.open(CloseGuard.java:184)
            at java.util.zip.Inflater.<init>(Inflater.java:82)
            at okio.GzipSource.<init>(GzipSource.java:62)
            at com.squareup.okhttp.internal.http.HttpEngine.unzip(HttpEngine.java:650)
            at com.squareup.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:832)
            at com.squareup.okhttp.Call.getResponse(Call.java:274)
            at com.squareup.okhttp.Call$ApplicationInterceptorChain.proceed(Call.java:230)
            at com.squareup.okhttp.Call.getResponseWithInterceptorChain(Call.java:201)
            at com.squareup.okhttp.Call.execute(Call.java:81)
            at com.parse.ParseOkHttpClient.executeInternal(ParseOkHttpClient.java:55)
            at com.parse.ParseHttpClient$ParseNetworkInterceptorChain.proceed(ParseHttpClient.java:155)
            at com.parse.ParsePlugins$1.intercept(ParsePlugins.java:111)
            at com.parse.ParseHttpClient$ParseNetworkInterceptorChain.proceed(ParseHttpClient.java:144)
            at com.parse.ParseHttpClient.execute(ParseHttpClient.java:119)
            at com.parse.ParseRequest$3.then(ParseRequest.java:195)
            at com.parse.ParseRequest$3.then(ParseRequest.java:192)
            at bolts.Task$15.run(Task.java:825)
            at bolts.BoltsExecutors$ImmediateExecutor.execute(BoltsExecutors.java:105)
            at bolts.Task.completeAfterTask(Task.java:816)
            at bolts.Task.continueWithTask(Task.java:628)
            at bolts.Task.continueWithTask(Task.java:639)
            at bolts.Task$13.then(Task.java:731)
            at bolts.Task$13.then(Task.java:719)
            at bolts.Task$15.run(Task.java:825)
            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:818)

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:bugImpaired feature or lacking behavior that is likely assumed

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions