Threads & New Connections
irwinbilling
irwin.billing at gmail.com
Thu Oct 20 02:48:30 EDT 2011
Here is the dump. http://pastebin.com/8RhQZatM
Norman Maurer-2 wrote:
>
> This sounds a bit high... Can you do a thread dump and paste it on
> pastebin or something else.
>
> Bye,
> Norman
>
>
> 2011/10/20 irwinbilling <irwin.billing@>:
>> What does it take for a worker thread to be released? After playing with
>> the
>> server for a while, it's sitting at *500* threads from the worker pool.
>> Is
>> this supposed to be normal behavior...?
>>
>>
>> Norman Maurer-2 wrote:
>>>
>>> I think the interesting thing is not the thread count. Its the count of
>>> th
>>> active threads...
>>>
>>> bye
>>> norman
>>>
>>> Am Donnerstag, 6. Oktober 2011 schrieb irwinbilling <irwin.billing@
>>> >:
>>>> Terrible mistake. I had a loose connection to the database for every
>>> client
>>>> that wasn't getting closed. The problem seems to have disappeared.
>>>> Although, threads continue to be made. I tried connecting clients
>>>> until
>>> the
>>>> thread count reached 90 (the connections were all closed explicitly).
>>>> Is
>>>> this normal behavior?
>>>>
>>>> Thanks,
>>>> Irwin
>>>>
>>>>
>>>> Norman Maurer-2 wrote:
>>>>>
>>>>> Are you 100 % sure you are not calling it ? With a database lookup in
>>>>> place you will need to use an ExecutionHandler to offload the task as
>>>>> otherwise you will block your IO-Thread.
>>>>>
>>>>> Maybe you could also attach an thread-dump (via jstack) and show use
>>>>> how your ChannelPipelineFactory implementations looks like.
>>>>>
>>>>> Bye,
>>>>> Norman
>>>>>
>>>>>
>>>>> 2011/10/5 irwinbilling <irwin.billing@>:
>>>>>> The handleUserSearch method performs a simple database search and
>>>>>> writes
>>>>>> the
>>>>>> result to the given channel. I do not call the method during my
>>>>>> tests.
>>>>>> I
>>>>>> only call logout.
>>>>>>
>>>>>>
>>>>>> Norman Maurer-2 wrote:
>>>>>>>
>>>>>>> What does handleUserSearch((MessageUserSearch) message, channel); do
>>>>>>> ?
>>>>>>>
>>>>>>> 2011/10/4 irwinbilling <irwin.billing@>:
>>>>>>>> Code:
>>>>>>>> public void messageReceived(ChannelHandlerContext ctx, MessageEvent
>>>>>>>> e)
>>>>>>>> {
>>>>>>>>
>>>>>>>> Message message_new = (Message) e.getMessage();
>>>>>>>>
>>>>>>>> if (message instanceof MessageLogout) {
>>>>>>>> logout((MessageLogout) message);
>>>>>>>> } else if (message instanceof MessageUserSearch) {
>>>>>>>> handleUserSearch((MessageUserSearch)
>>>>>>>> message,
>>>>>>>> channel);
>>>>>>>> }
>>>>>>>>
>>>>>>>> super.handleMessage(message, channel);
>>>>>>>> }
>>>>>>>> public void channelClosed(ChannelHandlerContext ctx,
>>>>>>>> ChannelStateEvent
>>>>>>>> e)
>>>>>>>> throws Exception {
>>>>>>>> if (channel != null) {
>>>>>>>> channel.getCloseFuture().removeListener(remover);
>>>>>>>>
>>>>>>>> channel.close();
>>>>>>>> }
>>>>>>>> super.channelClosed(ctx, e);
>>>>>>>> }
>>>>>>>>
>>>>>>>>
>>>>>>>> "channel" is a cached Channel for this connection. Could holding
>>>>>>>> onto
>>>>>>>> a
>>>>>>>> channel reference be causing this.
>>>>>>>>
>>>>>>>> 2011/10/4 irwinbilling <irwin.billing@>:
>>>>>>>>> Hello,
>>>>>>>>>
>>>>>>>>> I seem to be running into a very peculiar problem. Using the
>>>>>>>>> default
>>>>>>>>> ChannelFactory (Executors.newCachedThreadPool()) with a custom
>>>>>>>>> ChannelPipeline, the server seems to stop serving new connections
>>>>>>>>> after
>>>>>>>>> 39
>>>>>>>>> successful connections and message exchanges.
>>>>>>>>>
>>>>>>>>> When looking at the list of running threads, it seems that for
>>>>>>>>> every
>>>>>>>>> new
>>>>>>>>> connection, a new thread is started. When the channel
>>>>>>>>> disconnects,
>>>>>>>>> the
>>>>>>>>> thread stays alive (waiting at Unsafe.park). This happens until
>>>>>>>>> the
>>>>>>>>> 40th
>>>>>>>>> connection when the CHannelFactory.getPipeline() does not get
>>>>>>>>> called.
>>>>>>>>>
>>>>>>>>> What could cause an issue of this sort?
>>>>>>>>>
>>>>>>>>> Thanks!
>>>>>>>>>
>>>>>>>>> --
>>>>>>>>> View this message in context:
>>>>>>>>>
>>> http://netty-forums-and-mailing-lists.685743.n2.nabble.com/Threads-New-Connections-tp6859861p6859861.html
>>>>>>>>> Sent from the Netty User Group mailing list archive at Nabble.com.
>>>>>>>>> _______________________________________________
>>>>>>>>> netty-users mailing list
>>>>>>>>> netty-users at .jboss
>>>>>>>>> https://lists.jboss.org/mailman/listinfo/netty-users
>>>>>>>>>
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> netty-users mailing list
>>>>>>>> netty-users at .jboss<View this message in context:
>>> http://netty-forums-and-mailing-lists.685743.n2.nabble.com/Threads-New-Connections-tp6859861p6867246.html
>>>> Sent from the Netty User Group mailing list archive at Nabble.com.
>>>>
>>>> _______________________________________________
>>>> netty-users mailing list
>>>> netty-users at .jboss
>>>> https://lists.jboss.org/mailman/listinfo/netty-users
>>>
>>> _______________________________________________
>>> netty-users mailing list
>>> netty-users at .jboss
>>> https://lists.jboss.org/mailman/listinfo/netty-users
>>>
>>
>>
>> --
>> View this message in context:
>> http://netty-forums-and-mailing-lists.685743.n2.nabble.com/Threads-New-Connections-tp6859861p6911770.html
>> Sent from the Netty User Group mailing list archive at Nabble.com.
>> _______________________________________________
>> netty-users mailing list
>> netty-users at .jboss
>> https://lists.jboss.org/mailman/listinfo/netty-users
>>
>
> _______________________________________________
> netty-users mailing list
> netty-users at .jboss
> https://lists.jboss.org/mailman/listinfo/netty-users
>
--
View this message in context: http://netty-forums-and-mailing-lists.685743.n2.nabble.com/Threads-New-Connections-tp6859861p6911812.html
Sent from the Netty User Group mailing list archive at Nabble.com.
More information about the netty-users
mailing list