Issue Details (XML | Word | Printable)

Key: AMQ-2294
Type: Bug Bug
Status: Open Open
Priority: Major Major
Assignee: Unassigned
Reporter: Puneet Gupta
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
ActiveMQ

MessageProducer hangs when using many concurrent sessions

Created: 17/Jun/09 11:32 AM   Updated: 01/Jul/09 06:24 PM
Return to search
Component/s: Broker, JMS client
Affects Version/s: 5.2.0
Fix Version/s: None

Time Tracking:
Not Specified

File Attachments:
  Size
Text File Consumer_ThreadDump.txt 2009-06-17 12:57 PM Puneet Gupta 9 kB
Text File Producer_ThreadDump.txt 2009-06-17 11:34 AM Puneet Gupta 44 kB
Text File ServerDebugLog_ThreadDump.txt 2009-06-17 11:34 AM Puneet Gupta 686 kB
Environment: I am using the default activemq.xml config. tested and reproduced on both windows and linux machines
Issue Links:
Related
 


 Description  « Hide
If you create a client (producer) that creates 25 non-transacted sessions and concurrently starts sending messages. The producer will hang after sending exactly 2560 1K messages.

This behavior is very easily reproducible.



 All   Comments   Work Log   Change History   Subversion Commits   FishEye   Crucible      Sort Order: Ascending order - Click to sort in descending order
Puneet Gupta added a comment - 17/Jun/09 11:34 AM
The client seems to hang at org.apache.activemq.transport.FutureResponse.getResult()

java.lang.Thread.State: WAITING (parking)
at sun.misc.Unsafe.park(Native Method)

  • parking to wait for <0x03fc6578> (a java.util.concurrent.locks.Abstra
    ctQueuedSynchronizer$ConditionObject)
    at java.util.concurrent.locks.LockSupport.park(LockSupport.java:158)
    at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject
    .await(AbstractQueuedSynchronizer.java:1925)
    at java.util.concurrent.ArrayBlockingQueue.take(ArrayBlockingQueue.java:
    317)
    at org.apache.activemq.transport.FutureResponse.getResult(FutureResponse
    .java:40)
    at org.apache.activemq.transport.ResponseCorrelator.request(ResponseCorr
    elator.java:80)
    at org.apache.activemq.ActiveMQConnection.syncSendPacket(ActiveMQConnect
    ion.java:1233)
    at org.apache.activemq.ActiveMQSession.send(ActiveMQSession.java:1659)
  • locked <0x0454b128> (a java.lang.Object)
    at org.apache.activemq.ActiveMQMessageProducer.send(ActiveMQMessageProdu
    cer.java:227)
    at org.apache.activemq.ActiveMQMessageProducerSupport.send(ActiveMQMessa
    geProducerSupport.java:269)
    at perf.harness.ProducerObj.sendMsg(ProducerObj.java:317)
    at perf.harness.ProducerObj.run(ProducerObj.java:237)
    at java.lang.Thread.run(Thread.java:619)

Bruce Snyder added a comment - 17/Jun/09 12:04 PM
You indicated that you're using the default configuration which limits the size of all queues and topics to 5mb and, by default in ActiveMQ, producer flow control is enabled. So either the destination to which you're sending has filled up or the has flow control kicked in and paused the producers. Chances are this is the producer flow control.

Puneet Gupta added a comment - 17/Jun/09 12:37 PM
I did not mention that I have 25 Message Consumers also listening on the same queue. So there is no reason for the producers to hang as eventually the producers and consumers should achieve equilibrium message rate. The problem persists even after killing the producers and consumers and restarting the consumers.

Bruce Snyder added a comment - 17/Jun/09 12:53 PM
The consumers and/or producers are not sharing a Session object are they?

Puneet Gupta added a comment - 17/Jun/09 12:57 PM
No, The producer, server and consumer are all running on separate machines.

Puneet Gupta added a comment - 17/Jun/09 12:57 PM
Consumer Thread Dump is attached as well

Bruce Snyder added a comment - 17/Jun/09 01:26 PM
This could still be the broker invoking the producer flow control because the consumers are either not consuming messages are are too slow. Are the consumers actually consuming messages? If so, are they actually acknowledging messages? Please attach the code for your consumers.

Puneet Gupta added a comment - 20/Jun/09 01:08 PM
I am using DUPS_OK_ACKNOWLEDGE acknowledgement mode and I explicitly call acknowledge() only if the Acknowledge Mode is CLIENT_ACKNOWLEDGE.

This works ok if there is only 1 consumer on the queue. If I create multiple consumers I start to see the hang with Acknowledge Mode AUTO_ACKNOWLEDGE and DUPS_OK_ACKNOWLEDGE.

Here is the code:

public void onMessage ( Message aMessage )
{
try
{
if(aMessage != null)
{
System.out.println("received message" + aMessage);
if (session.getTransacted())
{
try
{ session.commit(); }catch(JMSException jmse)

{ System.err.println("Error committing transaction....see trace for more details"); jmse.printStackTrace(); }

}
}
else

{ if (session.getAcknowledgeMode() == Session.CLIENT_ACKNOWLEDGE) aMessage.acknowledge(); }

}catch (Exception e)

{ e.printStackTrace(); }

}


Puneet Gupta added a comment - 20/Jun/09 02:21 PM
Confirmed that this is only a problem with DUPS_OK_ACKNOWLEDGE and multiple sessions