Hi all,

I'm doing a deep dive debugging exercise on Apache.NMS.ActiveMQ 1.7.1 at the
moment and struggling!  We recently saw one of our new services in the wild
with over 300 threads named as "ActiveMQ Task" with
"Apache.NMS.ActiveMQ.dll!Apache.NMS.ActiveMQ.Threads.DedicatedTaskRunner.Run"
as the top stack frame.  We are trying to establish why the C# NMS library
has created all these threads.  Some questions...

I cannot find the Apache.NMS.ActiveMQ source code anywhere, only some out of
date mentions/links - I assume it is not open sourced any more?

I've spent all day trying to reproduce the issue but I can only ever get a
maximum of 1 thread per session at any point in time (as expected).  I am as
sure as I can be that we are not creating more than 10 or so sessions over a
single, global connection (assume that for now) - we call, in short,
session.CreateConsumer(dest).Listener += [ourHandler]; - in my debugging
I've established that this creates a thread on CreateConsumer, then throws
that thread away and is replaced with a new one when the Listener += is
executed - it doesn't seem to leak anything here.  Are there any other
scenarios (failure cases etc) where it may leak these threads?

I have looked at the decompiled source to get an indication of when these
threads are spawned and, ignoring `dedicatedTaskRunner = false` which I know
is possible, can only see the FailoverTask and the SessionExecutor that uses
the DedicatedTaskRunner (which creates threads named "ActiveMQ Task").

It is a very busy service so after consulting
http://activemq.apache.org/how-to-deal-with-large-number-of-threads-in-clients.html
I thought it might be due to load - but I can't see where any of that code
can live inside NMS, am I right in thinking that the C# NMS library is
designed to not have more than 1 thread per session (e.g. I should ignore
that webpage)?

In case anyone is interested, we are using the Obvs library to connect to
ActiveMQ - the topic subscription part is here: 
https://github.com/inter8ection/Obvs.ActiveMQ/blob/master/Obvs.ActiveMQ/MessageSource.cs

Has anyone else had this issue and what did you do to diagnose it?

Thanks very much!



--
View this message in context: 
http://activemq.2283324.n4.nabble.com/Apache-NMS-ActiveMQ-Threads-C-tp4704338.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Reply via email to