2

A connection to https://api.segment.io/ was leaked.

I just updated a few libraries in our Android app, particularly Okhttp3 (v3.8.1), and now I'm seeing this warning: "OkHttpClient: A connection to https://api.segment.io/ was leaked. Did you forget to close a response body?". So far I'm just seeing the warning on our Pixel XL running Android O. I know not many people are running Android O, but a few are running the preview so I'm trying to get our app compatible with a number of the changes in O. Is there any known fix to this warning? I've updated to the latest Segment version but that didn't make any difference.

Thanks,

Sterling

6replies Oldest first
  • Oldest first
  • Newest first
  • Active threads
  • Popular
  • Hi Sterling, could you clarify for me, is this error being thrown by the Segment Android analytics library?
    It appears we only use the OKhttp lib in some tests so I'm not sure there is any actionable step on our end.

    Let me know what you think.

    Reply Upvote
  • Hey  Wesley  

    It looks like a warning from Okhttp. All we do is create the global Analytics object and pass events and traits, etc to it and it does the rest. We don't provide any http client to segment, and I don't see anywhere that we would make calls to api.segment.io , so I don't know how this warning is happening. I figured the Segment android lib was using Okhttp, but if it's not, then I have no idea.

    -Sterling

    Reply Upvote
  • I am also getting this error. Do we know what is causing this and what is the solution to fix it.

    Reply Upvote
  • This is impacting overall app performance. There are a huge increase in Out of memory error after we integrated segment. We are even thinking of reverting back segment in case we dont find a solution for this.

    Reply Upvote
  • Hi, any update on this? We are also seeing this warning from the library. There's a resource leak somewhere in the Segment library.

     

    07-31 17:12:03.920 17529-17561/XXX W/OkHttpClient: A connection to https://api.segment.io/ was leaked. Did you forget to close a response body?

    Reply Upvote
  • for the last few years the Android OS source code has used the OkHttp library so if you're just opening a connection by the default Android implementation its possible you're triggering this @SegmentDevs

    I'm experiencing the same thing in a new project I've arrived at that I've upgraded to the latest Segment library. 

    Reply Upvote 1
reply to topic