2.1.x http client memory leak

179 views
Skip to first unread message

Jon Keys

unread,
Dec 12, 2014, 3:29:46 PM12/12/14
to ve...@googlegroups.com
I have a groovy module which makes a lot of http requests to external services.
I am seeing out of memory errors after a day or so of running continuously.
While profiling with YourKit I see thousands and thousands of `org.vertx.java.core.http.impl.DefaultHttpClient` objects hanging around.
I also see the old gen space growing steadily over time.

I am using pooling with maxPoolSize = 25.
Just to test I removed the maxPoolSize and disabled keepAlive but I'm still seeing the same issue.

After digging through a memory snapshot I can see the references to all these DefaultHttpClient objects are held in a local variable `closeHooks` in the event loop context.

My question is this: should I explicitly close each HttpClient after each request? Is there some method to cleanup the HttpClient resources automatically?

Based on the docs (http://vertx.io/core_manual_groovy.html#pooling-and-keep-alive) I was thinking this was all handled automatically.
 

Tim Fox

unread,
Dec 12, 2014, 3:33:42 PM12/12/14
to ve...@googlegroups.com
HttpClient is designed to be reused between requests, but when you're finished with it, you must close it.
--
You received this message because you are subscribed to the Google Groups "vert.x" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vertx+un...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Jon Keys

unread,
Dec 12, 2014, 3:37:45 PM12/12/14
to ve...@googlegroups.com


On Friday, December 12, 2014 3:33:42 PM UTC-5, Tim Fox wrote:
HttpClient is designed to be reused between requests, but when you're finished with it, you must close it.

That makes sense. I can't believe I've gone this long and never realized it.
Reply all
Reply to author
Forward
0 new messages