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.

Leaked connection warning after rate limit error

See original GitHub issue

After hitting a rate limit error, I start seeing a leaked connection error. The two errors are included below. The rate limit error is understandable since it is documented behavior, but the connection should not be leaked when hitting the rate limit.

Azure sdk versions

    <dependency>
      <groupId>com.microsoft.azure</groupId>
      <artifactId>azure</artifactId>
      <version>1.16.0</version>
    </dependency>
    <dependency>
      <groupId>com.microsoft.azure</groupId>
      <artifactId>azure-mgmt-resources</artifactId>
      <version>1.16.0</version>
    </dependency>

Rate limit error

Dec 14, 2018 2:44:53 AM okhttp3.internal.platform.Platform log
WARNING: A connection to https://management.azure.com/ was leaked. Did you forget to close a response body?
java.lang.Throwable: response.body().close()
	at okhttp3.internal.platform.Platform.getStackTraceForCloseable(Platform.java:148)
	at okhttp3.RealCall.captureCallStackTrace(RealCall.java:89)
	at okhttp3.RealCall.execute(RealCall.java:73)
	at retrofit2.OkHttpCall.execute(OkHttpCall.java:180)
	at retrofit2.adapter.rxjava.CallExecuteOnSubscribe.call(CallExecuteOnSubscribe.java:40)
	at retrofit2.adapter.rxjava.CallExecuteOnSubscribe.call(CallExecuteOnSubscribe.java:24)
	at rx.Observable.unsafeSubscribe(Observable.java:10327)
	at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:48)
	at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:33)
	at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
	at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
	at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
	at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
	at rx.Observable.subscribe(Observable.java:10423)
	at rx.Observable.subscribe(Observable.java:10390)
	at rx.observables.BlockingObservable.blockForSingle(BlockingObservable.java:443)
	at rx.observables.BlockingObservable.single(BlockingObservable.java:340)
	at com.microsoft.azure.management.containerservice.implementation.ManagedClustersInner.getAccessProfile(ManagedClustersInner.java:462)
	at com.microsoft.azure.management.containerservice.implementation.KubernetesClustersImpl.getAdminKubeConfigContent(KubernetesClustersImpl.java:160)

Connection leak error

Dec 14, 2018 2:44:53 AM okhttp3.internal.platform.Platform log
WARNING: A connection to https://management.azure.com/ was leaked. Did you forget to close a response body?
java.lang.Throwable: response.body().close()
	at okhttp3.internal.platform.Platform.getStackTraceForCloseable(Platform.java:148)
	at okhttp3.RealCall.captureCallStackTrace(RealCall.java:89)
	at okhttp3.RealCall.execute(RealCall.java:73)
	at retrofit2.OkHttpCall.execute(OkHttpCall.java:180)
	at retrofit2.adapter.rxjava.CallExecuteOnSubscribe.call(CallExecuteOnSubscribe.java:40)
	at retrofit2.adapter.rxjava.CallExecuteOnSubscribe.call(CallExecuteOnSubscribe.java:24)
	at rx.Observable.unsafeSubscribe(Observable.java:10327)
	at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:48)
	at rx.internal.operators.OnSubscribeMap.call(OnSubscribeMap.java:33)
	at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
	at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
	at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:48)
	at rx.internal.operators.OnSubscribeLift.call(OnSubscribeLift.java:30)
	at rx.Observable.subscribe(Observable.java:10423)
	at rx.Observable.subscribe(Observable.java:10390)
	at rx.observables.BlockingObservable.blockForSingle(BlockingObservable.java:443)
	at rx.observables.BlockingObservable.single(BlockingObservable.java:340)
	at com.microsoft.azure.management.containerservice.implementation.ManagedClustersInner.getAccessProfile(ManagedClustersInner.java:462)
	at com.microsoft.azure.management.containerservice.implementation.KubernetesClustersImpl.getAdminKubeConfigContent(KubernetesClustersImpl.java:160)

Issue Analytics

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

github_iconTop GitHub Comments

1reaction
anuchandycommented, Apr 17, 2019

@bendeitch, @ilooner thanks for reporting this issue.

I see a place where we miss to close the response stream. We’ve a retry interceptor to handle rate limit error, where we wait and retry upon receiving rate error (429). It looks like as part of handling 429, we’re not closing the response stream.

We’ll discuss this today within the team and come up with a plan to release the fix.

@ilooner Thanks again for exactly pin pointing that this happens during 429, it really helped the investigation.

0reactions
lmazuelcommented, Apr 29, 2019

Made it in 1.22

Read more comments on GitHub >

github_iconTop Results From Across the Web

java - SpringMVC, c3p0, hibernate, JPA Application leaking ...
The number of connections keeps growing until the application finally throws the too many connection warning shown above. My question is why is ......
Read more >
How to handle API rate limits: Do your integrations work at ...
An API rate limit might enforce, say, 100 requests per minute. Once requests exceed that number, it generates an error message to alert...
Read more >
NGINX Rate Limiting
The leaking water represents requests exiting the buffer for processing by the server, and the overflow represents requests that are discarded ...
Read more >
Rate-limiting strategies and techniques - Google Cloud
Leaky bucket: A leaky bucket is similar to a token bucket, but the rate is limited by the amount that can drip or...
Read more >
FAQ | Leak Defense System | Water Damage & Leak Protection
My panel is showing a connection error what do I do? ... in the Installation Guide it says not to solder the pipe...
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