Bug 52044 - JMS Subscriber used with many threads leads to javax.naming.NamingException: Something already bound with ActiveMQ
JMS Subscriber used with many threads leads to javax.naming.NamingException: ...
Status: RESOLVED FIXED
Product: JMeter
Classification: Unclassified
Component: Main
Nightly (Please specify date)
All All
: P2 normal (vote)
: ---
Assigned To: JMeter issues mailing list
:
Depends on: 51997
Blocks:
  Show dependency tree
 
Reported: 2011-10-17 19:17 UTC by Yaroslav
Modified: 2011-11-10 19:10 UTC (History)
1 user (show)



Attachments
screenshot with strange error (112.57 KB, image/jpeg)
2011-10-17 19:17 UTC, Yaroslav
Details
JMeter TP (12.79 KB, application/octet-stream)
2011-10-17 19:17 UTC, Yaroslav
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Yaroslav 2011-10-17 19:17:02 UTC
Created attachment 27800 [details]
screenshot with strange error

r1183374

See attached TP.

Run AMQ web admin monitor and open Queues tab - the queue displays "0" (zero) Number of consumers.

Run the TP and stop it in few seconds:

1) Jmeter is not stopping - "Shutting does all test treads. Please be patient" message is staying forever;
2) Check AMQ web-console - there are all initiated threads have not been closed its connections;
3) stramge error for "JMS Subscriber - 001" - Response message: javax.naming.NamingException: Something already bound at Elite_To_MorphoTrak;

ER:
1) Jmeter stops successfully; 
2) AMQ displays "0" consumers against the queue;
3) error for "JMS Subscriber - 001" has to be "0 message(s) received successfully";
Comment 1 Yaroslav 2011-10-17 19:17:35 UTC
Created attachment 27801 [details]
JMeter TP
Comment 2 Yaroslav 2011-10-17 20:41:58 UTC
Using "Shutdown" from menu also does not work (same behave as by Stop).
Comment 3 Philippe Mouawad 2011-10-18 06:43:37 UTC
(In reply to comment #0)
> Created attachment 27800 [details]
> screenshot with strange error
> 
> r1183374
> 
> See attached TP.
> 
> Run AMQ web admin monitor and open Queues tab - the queue displays "0" (zero)
> Number of consumers.
> 
> Run the TP and stop it in few seconds:
> 
> 1) Jmeter is not stopping - "Shutting does all test treads. Please be patient"
> message is staying forever;
JMeter cannot "shutdown" unless it receives a message because you set timeout to 0
(means no timeout) so JMeter is waiting on receive until it receives a message(I don't see any solution to
this unless interrupt is fixed in AMQ so stop will work)

My test with Stop works.


> 2) Check AMQ web-console - there are all initiated threads have not been closed
> its connections;
Yes duplicate of bug 51997

> 3) stramge error for "JMS Subscriber - 001" - Response message:
> javax.naming.NamingException: Something already bound at Elite_To_MorphoTrak;
> 
This issue is mentionned by many AMQ client and not reproductible with OpenJMS.
It is related to ReadOnlyContext and LazyCreateContext in AMQ, maybe you should
check AMQ issues.
I think it's a concurrency issue in AMQ JNDI layer.
Maybe you should submit an issue to AMQ.
Test with OpenJMS is OK.

> ER:
> 1) Jmeter stops successfully; 
> 2) AMQ displays "0" consumers against the queue;
> 3) error for "JMS Subscriber - 001" has to be "0 message(s) received
> successfully";
Comment 4 Philippe Mouawad 2011-10-18 20:42:27 UTC
From this issue, the only one I reproduce is:
stramge error for "JMS Subscriber - 001" - Response message:
> javax.naming.NamingException: Something already bound at Elite_To_MorphoTrak;

The other one is duplicate of bug 51997.
The first one (Shutdown blocking is regular) and works when Stop  is used.


I investigated this issue "javax.naming.NamingException: Something already bound".

I created a simple test case and tried not to cache Context and it works fine.
and in fact it is due to the fact that we cache Context and use it by many threads.
From this:
http://download.oracle.com/javase/jndi/tutorial/beyond/misc/sync.html

I conclude we should not do caching as it is not mandatory that context is Thread Safe (and it's not the case for AMQ one).
Comment 5 Philippe Mouawad 2011-10-18 20:58:52 UTC
Date: Tue Oct 18 20:58:08 2011
New Revision: 1185853

URL: http://svn.apache.org/viewvc?rev=1185853&view=rev
Log:
Bug 52044 - JMS Subscriber used with many threads leads to javax.naming.NamingException: Something already bound with ActiveMQ

Performances impact of No Caching of InitialContext are low.

Modified:
   jakarta/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/Utils.java
   jakarta/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/client/InitialContextFactory.java
   jakarta/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/client/Publisher.java
   jakarta/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/client/ReceiveSubscriber.java
   jakarta/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/PublisherSampler.java
   jakarta/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/SubscriberSampler.java
   jakarta/jmeter/trunk/xdocs/changes.xml
Comment 6 Philippe Mouawad 2011-10-19 19:46:15 UTC
Date: Wed Oct 19 19:44:57 2011
New Revision: 1186430

URL: http://svn.apache.org/viewvc?rev=1186430&view=rev
Log:
Bug 52044 - JMS Subscriber used with many threads leads to javax.naming.NamingException: Something already bound with ActiveMQ

Revert of modifications

Modified:
   jakarta/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/Utils.java
   jakarta/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/client/InitialContextFactory.java
   jakarta/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/client/Publisher.java
   jakarta/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/client/ReceiveSubscriber.java
   jakarta/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/PublisherSampler.java
   jakarta/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/sampler/SubscriberSampler.java
   jakarta/jmeter/trunk/xdocs/changes.xml
Comment 7 Philippe Mouawad 2011-10-19 20:53:29 UTC
Date: Wed Oct 19 20:51:36 2011
New Revision: 1186482

URL: http://svn.apache.org/viewvc?rev=1186482&view=rev
Log:
Bug 52044 - JMS Subscriber used with many threads leads to javax.naming.NamingException: Something already bound with ActiveMQ

Added ThreadId in cache key

Modified:
   jakarta/jmeter/trunk/src/protocol/jms/org/apache/jmeter/protocol/jms/client/InitialContextFactory.java
   jakarta/jmeter/trunk/xdocs/changes.xml