Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Properly close responses returned by POST requests #13

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

jobayle
Copy link

@jobayle jobayle commented Oct 14, 2019

The HTTP InfluxDB writer is leaking connections by not closing the response objects returned by calls to the post() method.

After a while the connection pool cannot create new connections and throws the following exception:

javax.ws.rs.ProcessingException: org.apache.http.conn.ConnectionPoolTimeoutException: Timeout waiting for connection from pool
	at io.dropwizard.client.DropwizardApacheConnector.apply(DropwizardApacheConnector.java:109)
	at org.glassfish.jersey.client.ClientRuntime.invoke(ClientRuntime.java:252)
	at org.glassfish.jersey.client.JerseyInvocation$1.call(JerseyInvocation.java:684)
	at org.glassfish.jersey.client.JerseyInvocation$1.call(JerseyInvocation.java:681)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
	at org.glassfish.jersey.internal.Errors.process(Errors.java:228)
	at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:444)
	at org.glassfish.jersey.client.JerseyInvocation.invoke(JerseyInvocation.java:681)
	at org.glassfish.jersey.client.JerseyInvocation$Builder.method(JerseyInvocation.java:437)
	at org.glassfish.jersey.client.JerseyInvocation$Builder.post(JerseyInvocation.java:343)
	at com.kickstarter.dropwizard.metrics.influxdb.io.InfluxDbHttpWriter.writeBytes(InfluxDbHttpWriter.java:33)
	at com.kickstarter.dropwizard.metrics.influxdb.io.Sender.send(Sender.java:61)
	at com.kickstarter.dropwizard.metrics.influxdb.InfluxDbMeasurementReporter.report(InfluxDbMeasurementReporter.java:75)
	at com.codahale.metrics.ScheduledReporter.report(ScheduledReporter.java:162)
	at com.codahale.metrics.ScheduledReporter$1.run(ScheduledReporter.java:117)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
	at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.http.conn.ConnectionPoolTimeoutException: Timeout waiting for connection from pool
	at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.leaseConnection(PoolingHttpClientConnectionManager.java:286)
	at org.apache.http.impl.conn.PoolingHttpClientConnectionManager$1.get(PoolingHttpClientConnectionManager.java:263)
	at org.apache.http.impl.execchain.MainClientExec.execute(MainClientExec.java:190)
	at org.apache.http.impl.execchain.ProtocolExec.execute(ProtocolExec.java:184)
	at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.java:88)
	at org.apache.http.impl.execchain.RedirectExec.execute(RedirectExec.java:110)
	at org.apache.http.impl.client.InternalHttpClient.doExecute(InternalHttpClient.java:184)
	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:82)
	at org.apache.http.impl.client.CloseableHttpClient.execute(CloseableHttpClient.java:107)
	at io.dropwizard.client.DropwizardApacheConnector.apply(DropwizardApacheConnector.java:87)
	... 22 more

@frewsxcv
Copy link

Hey @jobayle, thanks for all your pull request contributions! ⭐️

We're phasing out our usage of Dropwizard at Kickstarter, and we haven't prioritized maintaining this library. It seems like folks (like yourself) are utilizing this library though! Would you be interested in being a collaborator (w/ commit access) on this repo?

@jobayle
Copy link
Author

jobayle commented Oct 23, 2019

Hi @frewsxcv,
Sure, I'm interested in maintain this library, as we are to use this library in production very soon.
What would I have to do?

@frewsxcv
Copy link

Just sent you an invite! Feel free to merge your pull requests you have open, and make any changes to this library you see fit🚀

@jobayle
Copy link
Author

jobayle commented Oct 24, 2019

Invitation accepted, thank you!
One question: am I allowed to roll out new releases? and deploy to maven central?

@frewsxcv
Copy link

Hey @jobayle, I'd love to give you access to deploy new versions to Maven's central repository, but I'm not quite sure how to do that! Are you familiar with that process? Otherwise, would you be able to publish them under a non-Kickstarter namespace?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants