Skip to content

Unexpected connection leak message in 3.0.0-RC1 #2217

Closed
@omarkilani

Description

I'm using the published 3.0.0-RC1.

I'm seeing this message:

WARNING: A connection to https://api.push.apple.com/ was leaked. Did you forget to close a response body?
Jan 08, 2016 8:23:58 PM okhttp3.ConnectionPool pruneAndGetAllocationCount

Over and over.

My code looks like this:

    client.newCall(request).enqueue(new Callback() {
      override def onFailure(request: Request, throwable: IOException) {
      }

      override def onResponse(response: Response) {
        if (!response.isSuccessful()) {
          val body = response.body()
          val charStream = body.charStream()
          val reason = GSON.fromJson(charStream, classOf[APNSError])
          body.close()
        }
      }
    })

(Note that the example Gson recipe leaks the body there, but this doesn't.)

Do I need to close the body in the successful case even if I'm not reading it?

Thanks!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions