You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by thompsg4416 <gr...@gmail.com> on 2016/04/14 15:27:07 UTC

Stranded - ActiveMQ constantly Crashing

I've recently been left (with no working knowledge) an activeMQ windows
server installation.   

The problem I'm having (which I've read as much as I can about) is that the
memory percent used keeps climbing and eventually I'll have to restart the
activeMQ service and delete the db.data files and associated log files.

I have about 50 queues.  I'm trying to figure out which queue is crashing
the system but reading the activemq.log isn't really helping me much.  

Any advice on where I can look to find out which queue is making the system
crash?



--
View this message in context: http://activemq.2283324.n4.nabble.com/Stranded-ActiveMQ-constantly-Crashing-tp4710773.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Stranded - ActiveMQ constantly Crashing

Posted by "James A. Robinson" <ji...@highwire.org>.
Hi,

Are there any queues where there is no movement vs. ones where there is a
steady shift in enqueued/dequeued counts?  Or any topic where there are one
or more consumers and any pending messages to be dequeued?

I wouldn't typically expect a memory limit on a queue to cause a consumer
to not be able to read messages.  I would expect it to prevent a producer
from writing a new message.

Depending on our version of ActiveMQ I suppose it might be a situation
where a common socket is deadlocked due to the broker throttling a shared
connection because the producer keeps trying to send messages:

http://activemq.apache.org/producer-flow-control.html

When you say you are out of memory, are you saying your JVM has actually
run completely out of memory?  If you can browse the webconsole I'd be
surprised if that were the case.  But if it is, you can check your
configuration to see how it's set up to manage memory queue limits.

For example, on my setup I have this:

        <!-- http://activemq.apache.org/producer-flow-control.html -->
<systemUsage>
   <systemUsage sendFailIfNoSpaceAfterTimeout="3000">
<memoryUsage>
   <memoryUsage percentOfJvmHeap="70"/>
</memoryUsage>
<storeUsage>
   <storeUsage limit="12 gb"/>
</storeUsage>
<tempUsage>
   <tempUsage limit="4 gb"/>
</tempUsage>
   </systemUsage>
</systemUsage>

This attempts to ensure that the JVM will always have at least ~30% of its
MX memory limit available for operations unrelated to buffering messages.

The sendFailIfNoSpaceAfterTimeout attribute tells activemq to throw an
exception to producers if a producer tries to write a message and it is
blocked for more than 3 seconds waiting for memory on the queue to become
available.  But that's a dangerous attribute to add if your producers
aren't coded up to handle the situation (of course, if you're reached the
point where you are manually purging messages then perhaps it'd be fine to
enable to see what producers start failing).

In addition, by default I cap the queue and topic sizes unless they are
specifically called out as needing to be larger:

<!-- http://activemq.apache.org/producer-flow-control.html -->
<!-- http://activemq.apache.org/message-cursors.html -->
<destinationPolicy>
   <policyMap>
<policyEntries>
   <policyEntry topic=">" memoryLimit="1mb">
   </policyEntry>
   <policyEntry queue=">" memoryLimit="1mb" optimizedDispatch="true">
   </policyEntry>
                    <policyEntry queue="AL.>" memoryLimit="100mb"
optimizedDispatch="true">
                    </policyEntry>
</policyEntries>
   </policyMap>
</destinationPolicy>

I don't think you need to manually delete all the KahaDB logs to clear
space, I think just using the Purge option on a queue should clear it of
pending messages.  If you can't find any other means of tracking down the
bad queue, cycling through each queue one at a time and purging it could
show you where the bottleneck is.


Jim

Re: Stranded - ActiveMQ constantly Crashing

Posted by thompsg4416 <gr...@gmail.com>.
Thanks again for the quick replies gentlemen.

I actually got everything up and running again - this time by restarting
both the activeMQ service as well as the apache/tomcat service.  Yesterday I
did the same but it did not work.  Yesterday I actually had to delete the DB
and log files from the DB directory.

That said I will try enabling JMX and will look into your other suggestions. 

Given my inexperience and lack of a background in this area, I expect I'll
be back with quite a few more questions.  Your assistance has been greatly
appreciated.





--
View this message in context: http://activemq.2283324.n4.nabble.com/Stranded-ActiveMQ-constantly-Crashing-tp4710773p4710780.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Stranded - ActiveMQ constantly Crashing

Posted by Tim Bain <tb...@alumni.duke.edu>.
>From the sound of it, no one queue is overloading the broker; rather, you
have lots of queues that each have some messages, and the aggregate load is
the problem.  So don't look for the problem child, and instead focus on
protecting the entire broker.

First, you should enable Producer Flow Control, since its sole purpose is
to prevent the broker from running out of resources due to the receipt of
new messages before they put the whole broker in a bad state.  PFC stops
accepting new messages when a limit you set is reached, and doesn't accept
new ones till existing messages are consumed and resources are freed up.

Next, you should evaluate whether the heap size you're currently using is
large enough to support the load you expect to have.  If you're running out
of memory and your heap is tiny, it might just mean that whoever handed
this configuration to you didn't size it appropriately.  1GB should be able
to handle a pretty decent volume and would probably be big enough for the
setup you've described as long as your messages are a reasonable size, and
certainly 2GB should be plenty of room for most installations, so if you
get that high and are still running out of memory, something else is going
on.  Also, what GC strategy are you using with your JVM?  And how do you
know you're OOMing?

JMX doesn't require an installation, just configure it in your config
file.  Set useJmx="true", like <broker useJmx="true" brokerName="BROKER1">
See http://activemq.apache.org/jmx.html for more details.  You should
enable JMX; it's the most useful tool for troubleshooting an ActiveMQ
broker, so everyone should have it enabled (but secured with a username and
password).

Tim
On Apr 14, 2016 8:35 AM, "thompsg4416" <gr...@gmail.com> wrote:

Thanks for the reply Jim.

We do have the webconsole enabled and I am looking at the queues page.
These are all fairly active queues - I.E there are currently about 20 queues
with between 20-80 messages in them.

The problem is and what I've read is that the messages are no longer
dequeing. My limited experience and from what I've read, once you're beyond
your out of memory all messages stop dequeuing.    I restarted the service
but it reloaded the previous messages from the datastore.

The only way I've figured out how to get around this is to delete the DB and
log files under the kahadb folder.

I was hoping the activemq.log would give me more information I.E what queue
is overloading the system but it's not.

Unfortunately we do not have JMX installed.  any other ideas?  what can I
do?




--
View this message in context:
http://activemq.2283324.n4.nabble.com/Stranded-ActiveMQ-constantly-Crashing-tp4710773p4710775.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Stranded - ActiveMQ constantly Crashing

Posted by thompsg4416 <gr...@gmail.com>.
Thanks for the reply Jim. 

We do have the webconsole enabled and I am looking at the queues page. 
These are all fairly active queues - I.E there are currently about 20 queues
with between 20-80 messages in them. 

The problem is and what I've read is that the messages are no longer
dequeing. My limited experience and from what I've read, once you're beyond
your out of memory all messages stop dequeuing.    I restarted the service
but it reloaded the previous messages from the datastore. 

The only way I've figured out how to get around this is to delete the DB and
log files under the kahadb folder. 

I was hoping the activemq.log would give me more information I.E what queue
is overloading the system but it's not. 

Unfortunately we do not have JMX installed.  any other ideas?  what can I
do?  




--
View this message in context: http://activemq.2283324.n4.nabble.com/Stranded-ActiveMQ-constantly-Crashing-tp4710773p4710775.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.

Re: Stranded - ActiveMQ constantly Crashing

Posted by "James A. Robinson" <ji...@highwire.org>.
​Hi,

​
Looking for a queue or topic that had a large number of unconsumed messages
​ ​
would probably be a good star
​​
t.
​

If your
​server
 has the webconsole activated you can look at the queues and topics,
​ ​
for example if your server had a webconsole on port 8161:

http://<server>:8161//admin/queues.jsp
http://<server>:8161//admin/topics.jsp

​​
If your server has JMX enabled, you could connect to it with JConsole and
browse
​ ​
t
​​
he MBeans for the broker, looking at the MemoryPercentUsage attributes of
the
​ ​
queues and topics.

Or, if the server has the jolokia JMX to HTTP bridge enabled, you can
access the MBeans via that:

​$ ​
curl -s -d
'{"type":"read","mbean":"org.apache.activemq:brokerName=amq-prod-1,destinationName=AL.FAILED,destinationType=Queue,type=Broker","attribute":"MemoryPercentUsage"}'
http://amq-prod-1
​a​
:8161/api/jolokia/ | jq .
​
{
  "timestamp": 1460643204,
  "status": 200,
  "request": {
    "mbean":
"org.apache.activemq:brokerName=amq-prod-1,destinationName=AL.FAILED,destinationType=Queue,type=Broker",
    "attribute": "MemoryPercentUsage",
    "type": "read"
  },
  "value": 0
}

​That example shows me querying my server amq-prod-1a (broker name
amq-prod-1), and asking it to tell me the ​MemoryPercentUsage of the
AL.FAILED queue.  The value happens to be zero in this case, so it's not
using any memory.


Jim