You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by rabidgremlin <ra...@gmail.com> on 2007/03/06 20:25:58 UTC
Help ! - Broker Hanging up
Hi All,
I have a production application that receives SOAP "event" messages,
converts them into JMS messages and publishes them to a topic. I then have
multiple subscribers listening to these "events".
Under high loads (500-1000 events a minute) messages stop been published. I
continue to receive SOAP requests but my send() call on my TopicPublisher
just blocks.
We are able to consistently reproduce this behaviour in our test
environments but in a rather odd manner. If a test listener fails (by
running out of memory) then the TopicPublisher blocks on the send() and no
listeners get any messages. See Stacktrace 1 below.
I have tried setting setDispatchAsync(true) & setUseAsyncSend(true) on the
ActiveMQConnectionFactory for the TopicPublisher but I still get a hang up
but in a different place. See Stacktrace 2 below.
This happens with 4.01 and 4.1. I have also tried applying the patch listed
in AMQ-1093 to no avail.
This seems very odd since a broken listener should not effect the publisher
or the other listeners.
Anyone have any ideas ?
Jonathan
--------------------------------------------------
Stacktrace 1
java.lang.Object.wait(Native Method)
java.lang.Object.wait(Object.java:474)
edu.emory.mathcs.backport.java.util.concurrent.locks.CondVar.await(
CondVar.java:75)
edu.emory.mathcs.backport.java.util.concurrent.ArrayBlockingQueue.take(
ArrayBlockingQueue.java:318)
org.apache.activemq.transport.FutureResponse.getResult(FutureResponse.java
:38)
org.apache.activemq.transport.ResponseCorrelator.request(
ResponseCorrelator.java:74)
org.apache.activemq.ActiveMQConnection.syncSendPacket(
ActiveMQConnection.java:1112)
org.apache.activemq.ActiveMQSession.send(ActiveMQSession.java:1555)
org.apache.activemq.ActiveMQMessageProducer.send(
ActiveMQMessageProducer.java:462)
org.apache.activemq.ActiveMQMessageProducer.send(
ActiveMQMessageProducer.java:384)
veventsink.mq.Sender.send(Sender.java:88)
veventsink.soap.impl.logevent.EventSenderThread.run(EventSenderThread.java
:94)
java.lang.Thread.run(Thread.java:595)
---------------------------------------
Stacktrace 2
java.net.SocketOutputStream.socketWrite0(Native Method)
java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
java.net.SocketOutputStream.write(SocketOutputStream.java:136)
org.apache.activemq.transport.tcp.TcpBufferedOutputStream.flush(
TcpBufferedOutputStream.java:109)
java.io.DataOutputStream.flush(DataOutputStream.java:106)
org.apache.activemq.transport.tcp.TcpTransport.oneway(TcpTransport.java:119)
org.apache.activemq.transport.InactivityMonitor.oneway(
InactivityMonitor.java:141)
org.apache.activemq.transport.TransportFilter.oneway(TransportFilter.java
:80)
org.apache.activemq.transport.WireFormatNegotiator.oneway(
WireFormatNegotiator.java:93)
org.apache.activemq.transport.MutexTransport.oneway(MutexTransport.java:43)
org.apache.activemq.transport.ResponseCorrelator.oneway(
ResponseCorrelator.java:60)
org.apache.activemq.ActiveMQConnection.asyncSendPacket(
ActiveMQConnection.java:1151)
org.apache.activemq.ActiveMQSession.send(ActiveMQSession.java:1546)
org.apache.activemq.ActiveMQMessageProducer.send(
ActiveMQMessageProducer.java:465)
org.apache.activemq.ActiveMQMessageProducer.send(
ActiveMQMessageProducer.java:384)
veventsink.mq.Sender.send(Sender.java:87)
veventsink.soap.impl.logevent.EventSenderThread.run(EventSenderThread.java
:94)
java.lang.Thread.run(Thread.java:595)
-------------------------------------------
Other Info
- using an embedded broker with persistence and JMX turned off
- TopicSession (for the publisher) is created with transacted set to false
and Session.AUTO_ACKNOWLEDGE
- Topic is created with default settings
- Sends on TopicPublisher have priority of 1, 30 second lifespan and
DeliveryMode.NON_PERSISTENT
Re: Help ! - Broker Hanging up
Posted by Daryl Richter <ng...@comcast.net>.
On 3/6/07 7:28 PM, "rabidgremlin" <ra...@gmail.com> wrote:
> Would there be a separate buffer per connection ?
>
> Otherwise a broken listener would still cause all the others to block...
>
> Also with the current release would a slow listener cause all the other
> listeners to slow down because it is not clearing messages from the buffer
> fast enough ?
FWIW, this is a JMS flow control issue rather than ActiveMQ specific. I
have the identical issues with SonicMQ, for example. They have the same
"strategy" that Hiram describes below.
>
> Thanks
>
> Jonathan
>
>
> On 3/7/07, Hiram Chirino <hi...@hiramchirino.com> wrote:
>>
>> In the next major version (trunk branch) we have made some major
>> strides in this area so that messages just go to disk on your senario
>> instead of being buffered in memory. But all buffers (even ones on
>> disks) have limits and will eventually be reached. So you have to
>> detect dead clients anyways to avoid running out of disk space.
>>
--
Daryl
http://itsallsemantics.com
"We want great men who, when fortune frowns, will not be discouraged."
-- Colonel Henry Knox, 1776
Re: Help ! - Broker Hanging up
Posted by rabidgremlin <ra...@gmail.com>.
Would there be a separate buffer per connection ?
Otherwise a broken listener would still cause all the others to block...
Also with the current release would a slow listener cause all the other
listeners to slow down because it is not clearing messages from the buffer
fast enough ?
Thanks
Jonathan
On 3/7/07, Hiram Chirino <hi...@hiramchirino.com> wrote:
>
> In the next major version (trunk branch) we have made some major
> strides in this area so that messages just go to disk on your senario
> instead of being buffered in memory. But all buffers (even ones on
> disks) have limits and will eventually be reached. So you have to
> detect dead clients anyways to avoid running out of disk space.
>
Re: Help ! - Broker Hanging up
Posted by James Strachan <ja...@gmail.com>.
On 3/8/07, rabidgremlin <ra...@gmail.com> wrote:
> After digging around I found this link:
>
> http://activemq.apache.org/slow-consumer-handling.html
>
> Since I don't mind if I lose messages (they have a 30 sec lifespan anyway)
> it looks like I could set up a ConstantPendingMessageLimitStrategy to throw
> away messagse so I don't block.
>
> Should this work ?
Yes. The only other thing you might wanna do is set a low prefetch
value to avoid keeping too many messages around...
http://activemq.apache.org/what-is-the-prefetch-limit-for.html
This page is worth a read too
http://activemq.apache.org/my-producer-blocks.html
> I tried the following bit of code but it did not seem to make any difference
> (I suspect it is not correct):
>
> broker = new BrokerService();
>
> // no JMX or persistence needed
> broker.setUseJmx(false);
> broker.setPersistent(false);
>
> ConstantPendingMessageLimitStrategy strat = new
> ConstantPendingMessageLimitStrategy();
> strat.setLimit(50);
>
> PolicyEntry polEntry = new PolicyEntry();
> polEntry.setPendingMessageLimitStrategy(strat);
>
> PolicyMap policyMap = new PolicyMap();
> policyMap.setDefaultEntry(polEntry);
>
> broker.setDestinationPolicy(policyMap);
The above looks good to me. Try the prefetch setting & usageManager
tweaks mentioned in the 2 pages I gave and retest
--
James
-------
http://radio.weblogs.com/0112098/
Re: Help ! - Broker Hanging up
Posted by rabidgremlin <ra...@gmail.com>.
After digging around I found this link:
http://activemq.apache.org/slow-consumer-handling.html
Since I don't mind if I lose messages (they have a 30 sec lifespan anyway)
it looks like I could set up a ConstantPendingMessageLimitStrategy to throw
away messagse so I don't block.
Should this work ?
I tried the following bit of code but it did not seem to make any difference
(I suspect it is not correct):
broker = new BrokerService();
// no JMX or persistence needed
broker.setUseJmx(false);
broker.setPersistent(false);
ConstantPendingMessageLimitStrategy strat = new
ConstantPendingMessageLimitStrategy();
strat.setLimit(50);
PolicyEntry polEntry = new PolicyEntry();
polEntry.setPendingMessageLimitStrategy(strat);
PolicyMap policyMap = new PolicyMap();
policyMap.setDefaultEntry(polEntry);
broker.setDestinationPolicy(policyMap);
Jonathan
On 3/7/07, Hiram Chirino <hi...@hiramchirino.com> wrote:
>
> In the next major version (trunk branch) we have made some major
> strides in this area so that messages just go to disk on your senario
> instead of being buffered in memory. But all buffers (even ones on
> disks) have limits and will eventually be reached. So you have to
> detect dead clients anyways to avoid running out of disk space.
>
Re: Help ! - Broker Hanging up
Posted by Hiram Chirino <hi...@hiramchirino.com>.
In the next major version (trunk branch) we have made some major
strides in this area so that messages just go to disk on your senario
instead of being buffered in memory. But all buffers (even ones on
disks) have limits and will eventually be reached. So you have to
detect dead clients anyways to avoid running out of disk space.
On 3/6/07, rabidgremlin <ra...@gmail.com> wrote:
> Hi Hiram,
>
> Yep if you kill off the JVM of the broken publisher then things kick back
> into action....
>
> Not sure this is good "expected behaviour". A misbehaving listener should
> not stop the publisher or other consumers from working.
>
> I would have hoped that the connections between the broker and the
> publishers and the consumers would be divorced so that this kinda of thing
> could not happen.
>
> Is there a way to configure ActiveMQ to do this ? Perhaps having seperate
> in-memory queues for consumers or by turning on persistance ?
>
> Jonathan
>
> On 3/7/07, Hiram Chirino <hi...@hiramchirino.com> wrote:
> >
> > if you kill the JVM of the broken listener does the publisher
> > un-block? If so then this is the expected behaviour. The reason for
> > this is that even though the listner is logically broken, (it's not
> > receiving messages anymore), the broker does not know this since it
> > still has an active connection with the broker. Furthermore, the
> > broker is blocking the publisher because it is queueing up messages in
> > memory for that dead consumer.
> >
> >
>
--
Regards,
Hiram
Blog: http://hiramchirino.com
Re: Help ! - Broker Hanging up
Posted by rabidgremlin <ra...@gmail.com>.
Oops that should have read:
"Yep if you kill off the JVM of the broken listener then"
On 3/7/07, rabidgremlin <ra...@gmail.com> wrote:
>
> Hi Hiram,
>
> Yep if you kill off the JVM of the broken publisher then things kick back
> into action....
>
> Not sure this is good "expected behaviour". A misbehaving listener should
> not stop the publisher or other consumers from working.
>
> I would have hoped that the connections between the broker and the
> publishers and the consumers would be divorced so that this kinda of thing
> could not happen.
>
> Is there a way to configure ActiveMQ to do this ? Perhaps having seperate
> in-memory queues for consumers or by turning on persistance ?
>
> Jonathan
>
> On 3/7/07, Hiram Chirino <hi...@hiramchirino.com> wrote:
> >
> > if you kill the JVM of the broken listener does the publisher
> > un-block? If so then this is the expected behaviour. The reason for
> > this is that even though the listner is logically broken, (it's not
> > receiving messages anymore), the broker does not know this since it
> > still has an active connection with the broker. Furthermore, the
> > broker is blocking the publisher because it is queueing up messages in
> > memory for that dead consumer.
> >
> >
>
Re: Help ! - Broker Hanging up
Posted by rabidgremlin <ra...@gmail.com>.
Hi Hiram,
Yep if you kill off the JVM of the broken publisher then things kick back
into action....
Not sure this is good "expected behaviour". A misbehaving listener should
not stop the publisher or other consumers from working.
I would have hoped that the connections between the broker and the
publishers and the consumers would be divorced so that this kinda of thing
could not happen.
Is there a way to configure ActiveMQ to do this ? Perhaps having seperate
in-memory queues for consumers or by turning on persistance ?
Jonathan
On 3/7/07, Hiram Chirino <hi...@hiramchirino.com> wrote:
>
> if you kill the JVM of the broken listener does the publisher
> un-block? If so then this is the expected behaviour. The reason for
> this is that even though the listner is logically broken, (it's not
> receiving messages anymore), the broker does not know this since it
> still has an active connection with the broker. Furthermore, the
> broker is blocking the publisher because it is queueing up messages in
> memory for that dead consumer.
>
>
Re: Help ! - Broker Hanging up
Posted by Hiram Chirino <hi...@hiramchirino.com>.
if you kill the JVM of the broken listener does the publisher
un-block? If so then this is the expected behaviour. The reason for
this is that even though the listner is logically broken, (it's not
receiving messages anymore), the broker does not know this since it
still has an active connection with the broker. Furthermore, the
broker is blocking the publisher because it is queueing up messages in
memory for that dead consumer.
On 3/6/07, rabidgremlin <ra...@gmail.com> wrote:
> Hi All,
>
> I have a production application that receives SOAP "event" messages,
> converts them into JMS messages and publishes them to a topic. I then have
> multiple subscribers listening to these "events".
>
> Under high loads (500-1000 events a minute) messages stop been published. I
> continue to receive SOAP requests but my send() call on my TopicPublisher
> just blocks.
>
> We are able to consistently reproduce this behaviour in our test
> environments but in a rather odd manner. If a test listener fails (by
> running out of memory) then the TopicPublisher blocks on the send() and no
> listeners get any messages. See Stacktrace 1 below.
>
> I have tried setting setDispatchAsync(true) & setUseAsyncSend(true) on the
> ActiveMQConnectionFactory for the TopicPublisher but I still get a hang up
> but in a different place. See Stacktrace 2 below.
>
> This happens with 4.01 and 4.1. I have also tried applying the patch listed
> in AMQ-1093 to no avail.
>
> This seems very odd since a broken listener should not effect the publisher
> or the other listeners.
>
> Anyone have any ideas ?
>
> Jonathan
>
> --------------------------------------------------
> Stacktrace 1
> java.lang.Object.wait(Native Method)
> java.lang.Object.wait(Object.java:474)
> edu.emory.mathcs.backport.java.util.concurrent.locks.CondVar.await(
> CondVar.java:75)
> edu.emory.mathcs.backport.java.util.concurrent.ArrayBlockingQueue.take(
> ArrayBlockingQueue.java:318)
> org.apache.activemq.transport.FutureResponse.getResult(FutureResponse.java
> :38)
> org.apache.activemq.transport.ResponseCorrelator.request(
> ResponseCorrelator.java:74)
> org.apache.activemq.ActiveMQConnection.syncSendPacket(
> ActiveMQConnection.java:1112)
> org.apache.activemq.ActiveMQSession.send(ActiveMQSession.java:1555)
> org.apache.activemq.ActiveMQMessageProducer.send(
> ActiveMQMessageProducer.java:462)
> org.apache.activemq.ActiveMQMessageProducer.send(
> ActiveMQMessageProducer.java:384)
> veventsink.mq.Sender.send(Sender.java:88)
> veventsink.soap.impl.logevent.EventSenderThread.run(EventSenderThread.java
> :94)
> java.lang.Thread.run(Thread.java:595)
>
> ---------------------------------------
> Stacktrace 2
> java.net.SocketOutputStream.socketWrite0(Native Method)
> java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)
> java.net.SocketOutputStream.write(SocketOutputStream.java:136)
> org.apache.activemq.transport.tcp.TcpBufferedOutputStream.flush(
> TcpBufferedOutputStream.java:109)
> java.io.DataOutputStream.flush(DataOutputStream.java:106)
> org.apache.activemq.transport.tcp.TcpTransport.oneway(TcpTransport.java:119)
> org.apache.activemq.transport.InactivityMonitor.oneway(
> InactivityMonitor.java:141)
> org.apache.activemq.transport.TransportFilter.oneway(TransportFilter.java
> :80)
> org.apache.activemq.transport.WireFormatNegotiator.oneway(
> WireFormatNegotiator.java:93)
> org.apache.activemq.transport.MutexTransport.oneway(MutexTransport.java:43)
> org.apache.activemq.transport.ResponseCorrelator.oneway(
> ResponseCorrelator.java:60)
> org.apache.activemq.ActiveMQConnection.asyncSendPacket(
> ActiveMQConnection.java:1151)
> org.apache.activemq.ActiveMQSession.send(ActiveMQSession.java:1546)
> org.apache.activemq.ActiveMQMessageProducer.send(
> ActiveMQMessageProducer.java:465)
> org.apache.activemq.ActiveMQMessageProducer.send(
> ActiveMQMessageProducer.java:384)
> veventsink.mq.Sender.send(Sender.java:87)
> veventsink.soap.impl.logevent.EventSenderThread.run(EventSenderThread.java
> :94)
> java.lang.Thread.run(Thread.java:595)
>
> -------------------------------------------
> Other Info
> - using an embedded broker with persistence and JMX turned off
> - TopicSession (for the publisher) is created with transacted set to false
> and Session.AUTO_ACKNOWLEDGE
> - Topic is created with default settings
> - Sends on TopicPublisher have priority of 1, 30 second lifespan and
> DeliveryMode.NON_PERSISTENT
>
--
Regards,
Hiram
Blog: http://hiramchirino.com