activemq-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tom Martinec <>
Subject Re: Activemq 5.4.2 hangs when the temp disk usage is used
Date Mon, 17 Dec 2012 13:36:42 GMT

I fixed the issue on my own. Here is the list of things I have done:

1 - On the line 219 of
I unlocked the messagesLock that was created in the queue. I have done that,
because the writer thread waits for free space, but the consumers are locked
waiting until the writer thread releases the lock.

                boolean spaceAvailable = waitForTempSpace(maxWaitTime);
                if (spaceAvailable) {
                    ByteSequence bs = getByteSequence(node.getMessage());
                    return true;
                return false;

    protected boolean waitForTempSpace(long maxWaitTime) throws
InterruptedException {
    	if (cursorLock != null) {

    	boolean freeSpaceAvailable =

    	if (cursorLock != null) {
    	return freeSpaceAvailable;

2 - The writer and consumer threads are also synchronized on the object of
the cursor. So the step 1) was not enough. IMHO only one of the synchronized
primitive should be used. I decided to keep the RW lock that was created
inside the Queue class. By the way, the advantage of RW locks seemed to
never be used because of the second synchronization mechanism. This
basically required to remove the "synchronized" keywords from the cursors
and replace them by the RW lock from outside where the sync was still

3 - There was yet another deadlock looking behaviour. The
TempUsage.retrieveUsage() worked with full preallocated size of kahadb
storage, so the storage was always considered full. I extended the kahadb
interface to provide the count of free bytes in the PListStore and not just
its size.

Since then the ActiveMQ has been be working fine with no deadlocks. Note,
that I use the ActiveMQ only in a simple Queuing scenario, so I could have
broken something else by this change.

View this message in context:
Sent from the ActiveMQ - User mailing list archive at

View raw message