OutOfMemory in HttpClient

Trustin Lee trustin at gleamynode.net
Mon Jan 19 10:45:25 EST 2009


Hi jaimemm,

Thanks for the detailed report first of all.  It's weird that
something is creating a lot of threads.  Could you let me know what
exactly you have changed the example so that I can try it by myself?
Also, it would be great if you can attach a full thread dump just in
case the names of the threads are helpful to track down the problem.

At last but not least, you don't need to create a ChannelFactory for
each connection.  You need to share it for all connections.

Thanks for your patience,

— Trustin Lee, http://gleamynode.net/



On Mon, Jan 19, 2009 at 9:20 PM, jaimemm <jaimemm at gmail.com> wrote:
>
> Mmmmm it's not a memory leak...it's because I'm running out of OS memory to
> create Threads!!
> Please have a look to the attached screenshot from the jconsole.
>
> Why does it keep creating threads instead of reusing them? Is there any way
> to limit the number of threads?
>
>
> http://n2.nabble.com/file/n2181002/values.jpg values.jpg
> -----------------------------------
>
>
>
> Wesly smith wrote:
>>
>> Gee... you asked a very similar question like mine.
>>
>> In my case, I set the NIO selector loop number too high, such as 160
>> below, and I sent in 1M content size message from client, and it caused
>> out-of-message on my setup.
>>   ChannelFactory factory =
>>     new NioClientSocketChannelFactory(
>>         Executors.newCachedThreadPool(),
>>         Executors.newCachedThreadPool(), 160);
>>
>> But after I switch the default numbers (usually, the jvm pick up the core
>> numbers if you don't specify it), and I didn't see the out-of-memory
>> problem after I punched 100000 messages with each client message having
>> ChannelBuffer 1024x1024 bytes.
>>
>>
>>
>> jaimemm wrote:
>>>
>>> Taking the HTTP Client server example and including into a loop, to send
>>> N messages, the connection &  send message logic, the memory consumption
>>> raises over 500mb for just 700 messages (10Kb each) which causes the
>>> OutOfMemoryException. Am I doing something wrong? is there any piece of
>>> code susceptible of memory leaking? What should I check?
>>>
>>> thanks
>>>
>>
>>
>
> --
> View this message in context: http://n2.nabble.com/OutOfMemory-in-HttpClient-tp2170142p2181002.html
> Sent from the Netty User Group mailing list archive at Nabble.com.
>
> _______________________________________________
> netty-users mailing list
> netty-users at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/netty-users
>
>




More information about the netty-users mailing list