OutOfMemory Exception in vertx using HttpClient

461 views
Skip to first unread message

Bastian

unread,
Mar 17, 2014, 9:42:15 AM3/17/14
to ve...@googlegroups.com
Hi there,

I briefly spoke with Norman about this on IRC already but we decided to post it here.

I've some trouble with OutOfMemory Exceptions (and other) in vertx using HttpClient. 

What I see:

* Exception in thread "vert.x-eventloop-thread-4" java.lang.OutOfMemoryError: Java heap space
* java.util.concurrent.TimeoutException: The timeout period of 10000ms has been exceeded
* javax.net.ssl.SSLHandshakeException: Failed to create SSL connection

PS old slowly but constantly increases resulting in an OutOfMemory after several hours (7-8h). I had this on 4 servers and was able to reproduce.

Code, Stacktraces, and jmap info can be found at https://gist.github.com/bquilitz/3b8b0fe807917b14ebee , a heap dump is at https://db.tt/jM0JFpUZThe code uses a HttpClient and is fairly simple, the error occurs only after several hours. It seems as if byte[] are not freed from DefaultHttpClientResponse. The java file I posted in the gist it a reduced version - the original has an additional http server with a very simple handler. The API host is not publicly available but I could prepare a simple endpoint for testing.

With setKeepAlive(false) it seems to work ok - even after 9h+ memory looks good.


Best
Bastian

Norman Maurer

unread,
Mar 17, 2014, 11:15:18 AM3/17/14
to ve...@googlegroups.com, Bastian
Hi Bastian,

I think I found the problem and pushed a fix to an other branch.


Could you check with the branch and let me know if the problem goes away ?

Thanks
-- 
Norman Maurer
--
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.

Daniel Gelbshtein

unread,
Mar 17, 2014, 11:52:45 AM3/17/14
to ve...@googlegroups.com, Bastian, norman...@googlemail.com
Hi Bastian,

We had this problem too. In our case the process took about 25 minutes to fill up about 25GB of RAM. 
I can confirm that Normans fixed this problem.

Norman Maurer

unread,
Mar 17, 2014, 12:07:43 PM3/17/14
to ve...@googlegroups.com, Daniel Gelbshtein, Bastian
Awesome… Thanks Daniel for the feedback :)

-- 
Norman Maurer

Bastian Quilitz

unread,
Mar 18, 2014, 12:22:06 PM3/18/14
to Norman Maurer, ve...@googlegroups.com, Daniel Gelbshtein
Hi Norman,

I also can confirm that your changes fixed the problem. I tested with
your second commit.

Thanks a lot.

Bastian

On 03/17/2014 05:07 PM, Norman Maurer wrote:
> Awesome… Thanks Daniel for the feedback :)
>
> --
> Norman Maurer
>
> Am 17. März 2014 bei 08:52:46, Daniel Gelbshtein
> (daniel....@gmail.com <mailto:daniel....@gmail.com>) schrieb:
>
>> Hi Bastian,
>>
>> We had this problem too. In our case the process took about 25 minutes
>> to fill up about 25GB of RAM.
>> I can confirm that Normans fixed this problem.
>>
>>
>> On Monday, 17 March 2014 17:15:18 UTC+2, Norman Maurer wrote:
>>
>> Hi Bastian,
>>
>> I think I found the problem and pushed a fix to an other branch.
>>
>> https://github.com/eclipse/vert.x/tree/buffer_leak_body_handler
>> <https://github.com/eclipse/vert.x/tree/buffer_leak_body_handler>
>>
>> Could you check with the branch and let me know if the problem
>> goes away ?
>>
>> Thanks
>> --
>> Norman Maurer
>>
>> Am 17. März 2014 bei 06:42:17, Bastian (bqui...@gmail.com
>> <javascript:>) schrieb:
>>> send an email to vertx+un...@googlegroups.com <javascript:>.
>>> For more options, visit https://groups.google.com/d/optout
>>> <https://groups.google.com/d/optout>.
>>

Norman Maurer

unread,
Mar 18, 2014, 12:49:25 PM3/18/14
to Bastian Quilitz, ve...@googlegroups.com, Daniel Gelbshtein
Cool stuff… let me merge them into master.

-- 
Norman Maurer

Norman Maurer

unread,
Mar 18, 2014, 4:12:59 PM3/18/14
to Bastian Quilitz, ve...@googlegroups.com, Daniel Gelbshtein
It’s in master now..


-- 
Norman Maurer
Reply all
Reply to author
Forward
0 new messages