[ 
https://issues.apache.org/activemq/browse/AMQ-1995?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=47081#action_47081
 ] 

Gary Tully commented on AMQ-1995:
---------------------------------

good catch. this is a bug in the test, each Producer should have its own 
session as a session is only intended for use by a single tread at a time as 
per the JMS spec.
I am running a quick sanity check on the changes as I type. 

> Exception "The Consumer is closed" in multithreaded environment
> ---------------------------------------------------------------
>
>                 Key: AMQ-1995
>                 URL: https://issues.apache.org/activemq/browse/AMQ-1995
>             Project: ActiveMQ
>          Issue Type: Bug
>          Components: Broker
>    Affects Versions: 5.1.0, 5.2.0
>         Environment: Windows XP, JRE 1.5.0_12, 2GB Memory, Dual-core
>            Reporter: Martin Haslinger
>
> I got the following exception when running the TempQueueMemoryTest and 
> increasing number of producer, consumers and messages:
> javax.jms.IllegalStateException: The Consumer is closed
>       at 
> org.apache.activemq.ActiveMQMessageConsumer.checkClosed(ActiveMQMessageConsumer.java:699)
>       at 
> org.apache.activemq.ActiveMQMessageConsumer.getMessageListener(ActiveMQMessageConsumer.java:339)
>       at 
> org.apache.activemq.ActiveMQSession.checkMessageListener(ActiveMQSession.java:1864)
>       at 
> org.apache.activemq.ActiveMQMessageConsumer.checkMessageListener(ActiveMQMessageConsumer.java:717)
>       at 
> org.apache.activemq.ActiveMQMessageConsumer.receive(ActiveMQMessageConsumer.java:457)
>       at TempQueueMemoryTest$1Producer.run(TempQueueMemoryTest.java:94)
> The error happens at "Message reply = consumer.receive();", the message is 
> not received.
> I increased the number of consumers and produceres to 2 and the number of 
> messages to 5000. When using larger numbers the exception is thrown more 
> often (unpredictable how often exactly). It definitly seems to be a 
> multithreading-related problem because it only happens with multiple threads 
> producing/consuming and the more threads you have the more often it happens.
> Tested with 5.2 RC2.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to