You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by marcin80 <mt...@gmail.com> on 2010/01/12 12:59:24 UTC

Thread for each client

Hi,

I'm using ActiveMQ 5.2 and I've noticed thad ActiveMQ create new thread for
every connection but even the client will disconnect its thread still alive
(state RUNNABLE). It is ActiveMQ normal behavior?
Can I change this? I would like to finalize thread if client will
dissconnect.

Cheers,
Marcin
-- 
View this message in context: http://old.nabble.com/Thread-for-each-client-tp27126558p27126558.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Thread for each client

Posted by Rob Davies <ra...@gmail.com>.
Hi Marcin,

the thread is allocated from a pool - it should get collected after a  
minute (I think) - you not seeing that ?

On 12 Jan 2010, at 11:59, marcin80 wrote:

>
> Hi,
>
> I'm using ActiveMQ 5.2 and I've noticed thad ActiveMQ create new  
> thread for
> every connection but even the client will disconnect its thread  
> still alive
> (state RUNNABLE). It is ActiveMQ normal behavior?
> Can I change this? I would like to finalize thread if client will
> dissconnect.
>
> Cheers,
> Marcin
> -- 
> View this message in context: http://old.nabble.com/Thread-for-each-client-tp27126558p27126558.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>

Rob Davies
http://twitter.com/rajdavies
I work here: http://fusesource.com
My Blog: http://rajdavies.blogspot.com/
I'm writing this: http://www.manning.com/snyder/






Re: Thread for each client

Posted by moreno9000 <mo...@italtel.it>.
To disable JMX must I set useJms="false" in <broker> section of activemq.xml?

If I disable JMX, will it be possible to use AMQ Console to monitor
the broker?

In client code I call some MBean methods (for example queue.purge()).
No JMX means no possibility to call mbean methods or two things
aren't connected?

Thanks
Moreno



rajdavies wrote:
> 
> that'll be the jmx implementation - which is part of the JRE - can you  
> run with out jmx ?
> 
> On 19 Jan 2010, at 16:25, moreno9000 wrote:
> 
>>
>> Hi rajdavies,
>> I see a lot of threads like this one:
>>
>> "JMX server connection timeout 6925" daemon prio=10 tid=0x08faf000
>> nid=0x2759 in Object.wait() [0xac0ae000..0xac0af130]
>>   java.lang.Thread.State: TIMED_WAITING (on object monitor)
>> 	at java.lang.Object.wait(Native Method)
>> 	- waiting on <0xd5fcec60> (a [I)
>> 	at com.sun.jmx.remote.internal.ServerCommunicatorAdmin 
>> $Timeout.run(Unknown
>> Source)
>> 	- locked <0xd5fcec60> (a [I)
>> 	at java.lang.Thread.run(Unknown Source)
>>
>> Thanks
>> Moreno
>>
>>
>> rajdavies wrote:
>>>
>>> Hi moreno,
>>>
>>> can you take a stack trace of the broker ? - the threads should be
>>> getting garbage collected
>>>
>>> thanks,
>>>
>>> Rob
>>> On 19 Jan 2010, at 10:37, moreno9000 wrote:
>>>
>>>>
>>>> I confirm Marcin's problem (with AMQ 5.3).
>>>>
>>>> One producer (java application with transport=openwire)
>>>> For each message producer open a Connection, send a msg, close the
>>>> Connection.
>>>>
>>>> Server side no problem for what concern file descriptors opened,
>>>> memory usage, socket opened (with netstat I see all  
>>>> conn=ESTABLISHED).
>>>>
>>>> Problems with threads.
>>>>
>>>> A new thread is created (inside AMQ) for every producer's open-send-
>>>> close.
>>>> Threads don't disappear even if producer call connection.close()
>>>> (they disappear after 20-30 seconds from producer's death).
>>>>
>>>> In activemq.xml I set producerFlowControl=false,
>>>> transport.closeAsync=false.
>>>>
>>>> AMQ run with these options:
>>>> -Xmx1024M, -Dorg.apache.activemq.UseDedicatedTaskRunner=false.
>>>>
>>>> Producer set jms.useAsyncSend=false.
>>>>
>>>> Are there other configurations I can try to stop thread's increment?
>>>>
>>>> Many thanks
>>>> Moreno
>>>>
>>>>
>>>>
>>>>
>>>> marcin80 wrote:
>>>>>
>>>>> Hi,
>>>>>
>>>>> I'm using ActiveMQ 5.2 and I've noticed thad ActiveMQ create new
>>>>> thread
>>>>> for every connection but even the client will disconnect its thread
>>>>> still
>>>>> alive (state RUNNABLE). It is ActiveMQ normal behavior?
>>>>> Can I change this? I would like to finalize thread if client will
>>>>> dissconnect.
>>>>>
>>>>> Cheers,
>>>>> Marcin
>>>>>
>>>>
>>>> -- 
>>>> View this message in context:
>>>> http://old.nabble.com/Thread-for-each-client- 
>>>> tp27126558p27223897.html
>>>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>>>
>>>
>>> Rob Davies
>>> http://twitter.com/rajdavies
>>> I work here: http://fusesource.com
>>> My Blog: http://rajdavies.blogspot.com/
>>> I'm writing this: http://www.manning.com/snyder/
>>>
>>>
>>>
>>>
>>>
>>>
>>>
>>
>> -- 
>> View this message in context:
>> http://old.nabble.com/Thread-for-each-client-tp27126558p27228469.html
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
> 
> Rob Davies
> http://twitter.com/rajdavies
> I work here: http://fusesource.com
> My Blog: http://rajdavies.blogspot.com/
> I'm writing this: http://www.manning.com/snyder/
> 
> 
> 
> 
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Thread-for-each-client-tp27126558p27238638.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Thread for each client

Posted by Rob Davies <ra...@gmail.com>.
that'll be the jmx implementation - which is part of the JRE - can you  
run with out jmx ?

On 19 Jan 2010, at 16:25, moreno9000 wrote:

>
> Hi rajdavies,
> I see a lot of threads like this one:
>
> "JMX server connection timeout 6925" daemon prio=10 tid=0x08faf000
> nid=0x2759 in Object.wait() [0xac0ae000..0xac0af130]
>   java.lang.Thread.State: TIMED_WAITING (on object monitor)
> 	at java.lang.Object.wait(Native Method)
> 	- waiting on <0xd5fcec60> (a [I)
> 	at com.sun.jmx.remote.internal.ServerCommunicatorAdmin 
> $Timeout.run(Unknown
> Source)
> 	- locked <0xd5fcec60> (a [I)
> 	at java.lang.Thread.run(Unknown Source)
>
> Thanks
> Moreno
>
>
> rajdavies wrote:
>>
>> Hi moreno,
>>
>> can you take a stack trace of the broker ? - the threads should be
>> getting garbage collected
>>
>> thanks,
>>
>> Rob
>> On 19 Jan 2010, at 10:37, moreno9000 wrote:
>>
>>>
>>> I confirm Marcin's problem (with AMQ 5.3).
>>>
>>> One producer (java application with transport=openwire)
>>> For each message producer open a Connection, send a msg, close the
>>> Connection.
>>>
>>> Server side no problem for what concern file descriptors opened,
>>> memory usage, socket opened (with netstat I see all  
>>> conn=ESTABLISHED).
>>>
>>> Problems with threads.
>>>
>>> A new thread is created (inside AMQ) for every producer's open-send-
>>> close.
>>> Threads don't disappear even if producer call connection.close()
>>> (they disappear after 20-30 seconds from producer's death).
>>>
>>> In activemq.xml I set producerFlowControl=false,
>>> transport.closeAsync=false.
>>>
>>> AMQ run with these options:
>>> -Xmx1024M, -Dorg.apache.activemq.UseDedicatedTaskRunner=false.
>>>
>>> Producer set jms.useAsyncSend=false.
>>>
>>> Are there other configurations I can try to stop thread's increment?
>>>
>>> Many thanks
>>> Moreno
>>>
>>>
>>>
>>>
>>> marcin80 wrote:
>>>>
>>>> Hi,
>>>>
>>>> I'm using ActiveMQ 5.2 and I've noticed thad ActiveMQ create new
>>>> thread
>>>> for every connection but even the client will disconnect its thread
>>>> still
>>>> alive (state RUNNABLE). It is ActiveMQ normal behavior?
>>>> Can I change this? I would like to finalize thread if client will
>>>> dissconnect.
>>>>
>>>> Cheers,
>>>> Marcin
>>>>
>>>
>>> -- 
>>> View this message in context:
>>> http://old.nabble.com/Thread-for-each-client- 
>>> tp27126558p27223897.html
>>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>>
>>
>> Rob Davies
>> http://twitter.com/rajdavies
>> I work here: http://fusesource.com
>> My Blog: http://rajdavies.blogspot.com/
>> I'm writing this: http://www.manning.com/snyder/
>>
>>
>>
>>
>>
>>
>>
>
> -- 
> View this message in context: http://old.nabble.com/Thread-for-each-client-tp27126558p27228469.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>

Rob Davies
http://twitter.com/rajdavies
I work here: http://fusesource.com
My Blog: http://rajdavies.blogspot.com/
I'm writing this: http://www.manning.com/snyder/






Re: Thread for each client

Posted by moreno9000 <mo...@italtel.it>.
Hi rajdavies,
I see a lot of threads like this one:

"JMX server connection timeout 6925" daemon prio=10 tid=0x08faf000
nid=0x2759 in Object.wait() [0xac0ae000..0xac0af130]
   java.lang.Thread.State: TIMED_WAITING (on object monitor)
	at java.lang.Object.wait(Native Method)
	- waiting on <0xd5fcec60> (a [I)
	at com.sun.jmx.remote.internal.ServerCommunicatorAdmin$Timeout.run(Unknown
Source)
	- locked <0xd5fcec60> (a [I)
	at java.lang.Thread.run(Unknown Source)

Thanks
Moreno


rajdavies wrote:
> 
> Hi moreno,
> 
> can you take a stack trace of the broker ? - the threads should be  
> getting garbage collected
> 
> thanks,
> 
> Rob
> On 19 Jan 2010, at 10:37, moreno9000 wrote:
> 
>>
>> I confirm Marcin's problem (with AMQ 5.3).
>>
>> One producer (java application with transport=openwire)
>> For each message producer open a Connection, send a msg, close the
>> Connection.
>>
>> Server side no problem for what concern file descriptors opened,
>> memory usage, socket opened (with netstat I see all conn=ESTABLISHED).
>>
>> Problems with threads.
>>
>> A new thread is created (inside AMQ) for every producer's open-send- 
>> close.
>> Threads don't disappear even if producer call connection.close()
>> (they disappear after 20-30 seconds from producer's death).
>>
>> In activemq.xml I set producerFlowControl=false,  
>> transport.closeAsync=false.
>>
>> AMQ run with these options:
>> -Xmx1024M, -Dorg.apache.activemq.UseDedicatedTaskRunner=false.
>>
>> Producer set jms.useAsyncSend=false.
>>
>> Are there other configurations I can try to stop thread's increment?
>>
>> Many thanks
>> Moreno
>>
>>
>>
>>
>> marcin80 wrote:
>>>
>>> Hi,
>>>
>>> I'm using ActiveMQ 5.2 and I've noticed thad ActiveMQ create new  
>>> thread
>>> for every connection but even the client will disconnect its thread  
>>> still
>>> alive (state RUNNABLE). It is ActiveMQ normal behavior?
>>> Can I change this? I would like to finalize thread if client will
>>> dissconnect.
>>>
>>> Cheers,
>>> Marcin
>>>
>>
>> -- 
>> View this message in context:
>> http://old.nabble.com/Thread-for-each-client-tp27126558p27223897.html
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
> 
> Rob Davies
> http://twitter.com/rajdavies
> I work here: http://fusesource.com
> My Blog: http://rajdavies.blogspot.com/
> I'm writing this: http://www.manning.com/snyder/
> 
> 
> 
> 
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/Thread-for-each-client-tp27126558p27228469.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Thread for each client

Posted by Rob Davies <ra...@gmail.com>.
Hi moreno,

can you take a stack trace of the broker ? - the threads should be  
getting garbage collected

thanks,

Rob
On 19 Jan 2010, at 10:37, moreno9000 wrote:

>
> I confirm Marcin's problem (with AMQ 5.3).
>
> One producer (java application with transport=openwire)
> For each message producer open a Connection, send a msg, close the
> Connection.
>
> Server side no problem for what concern file descriptors opened,
> memory usage, socket opened (with netstat I see all conn=ESTABLISHED).
>
> Problems with threads.
>
> A new thread is created (inside AMQ) for every producer's open-send- 
> close.
> Threads don't disappear even if producer call connection.close()
> (they disappear after 20-30 seconds from producer's death).
>
> In activemq.xml I set producerFlowControl=false,  
> transport.closeAsync=false.
>
> AMQ run with these options:
> -Xmx1024M, -Dorg.apache.activemq.UseDedicatedTaskRunner=false.
>
> Producer set jms.useAsyncSend=false.
>
> Are there other configurations I can try to stop thread's increment?
>
> Many thanks
> Moreno
>
>
>
>
> marcin80 wrote:
>>
>> Hi,
>>
>> I'm using ActiveMQ 5.2 and I've noticed thad ActiveMQ create new  
>> thread
>> for every connection but even the client will disconnect its thread  
>> still
>> alive (state RUNNABLE). It is ActiveMQ normal behavior?
>> Can I change this? I would like to finalize thread if client will
>> dissconnect.
>>
>> Cheers,
>> Marcin
>>
>
> -- 
> View this message in context: http://old.nabble.com/Thread-for-each-client-tp27126558p27223897.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>

Rob Davies
http://twitter.com/rajdavies
I work here: http://fusesource.com
My Blog: http://rajdavies.blogspot.com/
I'm writing this: http://www.manning.com/snyder/






Re: Thread for each client

Posted by moreno9000 <mo...@italtel.it>.
I confirm Marcin's problem (with AMQ 5.3).

One producer (java application with transport=openwire)
For each message producer open a Connection, send a msg, close the
Connection.

Server side no problem for what concern file descriptors opened,
memory usage, socket opened (with netstat I see all conn=ESTABLISHED).

Problems with threads.

A new thread is created (inside AMQ) for every producer's open-send-close.
Threads don't disappear even if producer call connection.close()
(they disappear after 20-30 seconds from producer's death).

In activemq.xml I set producerFlowControl=false, transport.closeAsync=false.

AMQ run with these options: 
-Xmx1024M, -Dorg.apache.activemq.UseDedicatedTaskRunner=false.

Producer set jms.useAsyncSend=false.

Are there other configurations I can try to stop thread's increment?

Many thanks
Moreno




marcin80 wrote:
> 
> Hi,
> 
> I'm using ActiveMQ 5.2 and I've noticed thad ActiveMQ create new thread
> for every connection but even the client will disconnect its thread still
> alive (state RUNNABLE). It is ActiveMQ normal behavior?
> Can I change this? I would like to finalize thread if client will
> dissconnect.
> 
> Cheers,
> Marcin
> 

-- 
View this message in context: http://old.nabble.com/Thread-for-each-client-tp27126558p27223897.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Thread for each client

Posted by marcin80 <mt...@gmail.com>.
Hi,

Thanks for your replay.
Netstat returns following (for 61616 port):

C:\>netstat -an | find "61616"
  TCP    127.0.0.1:1975         127.0.0.1:61616        ESTABLISHED
  TCP    127.0.0.1:1979         127.0.0.1:61616        ESTABLISHED
  TCP    127.0.0.1:1980         127.0.0.1:61616        ESTABLISHED
  TCP    127.0.0.1:2037         127.0.0.1:61616        ESTABLISHED
  TCP    127.0.0.1:2038         127.0.0.1:61616        ESTABLISHED
  TCP    127.0.0.1:2039         127.0.0.1:61616        ESTABLISHED
  TCP    127.0.0.1:2040         127.0.0.1:61616        ESTABLISHED
  TCP    127.0.0.1:2041         127.0.0.1:61616        ESTABLISHED
  TCP    127.0.0.1:2042         127.0.0.1:61616        ESTABLISHED
  TCP    127.0.0.1:2043         127.0.0.1:61616        ESTABLISHED
  TCP    127.0.0.1:2044         127.0.0.1:61616        ESTABLISHED
  TCP    127.0.0.1:61616        0.0.0.0:0              LISTENING
  TCP    127.0.0.1:61616        127.0.0.1:1975         ESTABLISHED
  TCP    127.0.0.1:61616        127.0.0.1:1979         ESTABLISHED
  TCP    127.0.0.1:61616        127.0.0.1:1980         ESTABLISHED
  TCP    127.0.0.1:61616        127.0.0.1:2037         ESTABLISHED
  TCP    127.0.0.1:61616        127.0.0.1:2038         ESTABLISHED
  TCP    127.0.0.1:61616        127.0.0.1:2039         ESTABLISHED
  TCP    127.0.0.1:61616        127.0.0.1:2040         ESTABLISHED
  TCP    127.0.0.1:61616        127.0.0.1:2041         ESTABLISHED
  TCP    127.0.0.1:61616        127.0.0.1:2042         ESTABLISHED
  TCP    127.0.0.1:61616        127.0.0.1:2043         ESTABLISHED
  TCP    127.0.0.1:61616        127.0.0.1:2044         ESTABLISHED

Cheers,
Marcin



Gary Tully wrote:
> 
> With a normal disconnect from a java client those reader threads should
> disappear. With an abnormal disconnect, where the socket is not fully
> closed, it can take some time (os tcp config dependent) for the broker to
> identify the connection as closed.
> 
> What does netstat tell you about the active connections to the brokers
> listen port. Are there a bunch of sockets in timed wait state?
> 
> 
> 2010/1/12 marcin80 <mt...@gmail.com>
> 
>>
>> Hi,
>>
>> I'm using ActiveMQ 5.2 and I've noticed thad ActiveMQ create new thread
>> for
>> every connection but even the client will disconnect its thread still
>> alive
>> (state RUNNABLE). It is ActiveMQ normal behavior?
>> Can I change this? I would like to finalize thread if client will
>> dissconnect.
>>
>> Cheers,
>> Marcin
>> --
>> View this message in context:
>> http://old.nabble.com/Thread-for-each-client-tp27126558p27126558.html
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> http://blog.garytully.com
> 
> Open Source Integration
> http://fusesource.com
> 
> 

-- 
View this message in context: http://old.nabble.com/Thread-for-each-client-tp27126558p27127125.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Thread for each client

Posted by Gary Tully <ga...@gmail.com>.
With a normal disconnect from a java client those reader threads should
disappear. With an abnormal disconnect, where the socket is not fully
closed, it can take some time (os tcp config dependent) for the broker to
identify the connection as closed.

What does netstat tell you about the active connections to the brokers
listen port. Are there a bunch of sockets in timed wait state?


2010/1/12 marcin80 <mt...@gmail.com>

>
> Hi,
>
> I'm using ActiveMQ 5.2 and I've noticed thad ActiveMQ create new thread for
> every connection but even the client will disconnect its thread still alive
> (state RUNNABLE). It is ActiveMQ normal behavior?
> Can I change this? I would like to finalize thread if client will
> dissconnect.
>
> Cheers,
> Marcin
> --
> View this message in context:
> http://old.nabble.com/Thread-for-each-client-tp27126558p27126558.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>


-- 
http://blog.garytully.com

Open Source Integration
http://fusesource.com