You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by John Pederzolli <jp...@gmail.com> on 2006/04/06 18:24:55 UTC

Transaction Retry Problems (AMQ4

I have a Spring/Jencks/AMQ4 setup where I am sending 100 messages and causing
every 5th to fail via a RuntimeException in the consumer. Initially the
messages are getting retried as they should, however I see this exception
showing up quite a bit:

[DEBUG] 2006-04-06 08:57:30,161  -
org.apache.activemq.ra.ServerSessionImpl:17 (ServerSessionImpl.java:252)-
Endpoint did not release properly:
org.apache.activemq.ra.InvalidMessageEndpointException
org.apache.activemq.ra.InvalidMessageEndpointException
	at
org.apache.activemq.ra.MessageEndpointProxy$MessageEndpointDead.release(MessageEndpointProxy.java:156)
	at
org.apache.activemq.ra.MessageEndpointProxy.release(MessageEndpointProxy.java:68)
	at
org.apache.activemq.ra.ServerSessionImpl.close(ServerSessionImpl.java:250)
	at
org.apache.activemq.ra.ServerSessionPoolImpl.removeFromPool(ServerSessionPoolImpl.java:180)
	at org.apache.activemq.ra.ServerSessionImpl.run(ServerSessionImpl.java:177)
	at
org.apache.geronimo.connector.work.WorkerContext.run(WorkerContext.java:291)
	at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown
Source)
	at java.lang.Thread.run(Thread.java:595)

Eventually, messages are simply not consumed at all (after about 20 or so).
They are put on the queue however and appear to be consumed after a restart
of my application, when this cycle starts again (stopping around 20 or so).
Debug logs show the following when a message is placed on the queue but not
consumed:

[DEBUG] 2006-04-06 09:03:08,329  -
apache.activemq.store.journal.JournalMessageStore
(JournalMessageStore.java:97)- Journalled message add for:
ID:HOSTNAME-3109-1144339322001-3:2:1:1:97, at: 0:195384
[DEBUG] 2006-04-06 09:03:08,329  -
activemq.broker.region.Queue.transactionQueue (Queue.java:409)- No
subscriptions registered, will not dispatch message at this time.

Is there a configuration issue here or a legitimate bug? Thank you.


--
View this message in context: http://www.nabble.com/Transaction-Retry-Problems-%28AMQ4-t1406942.html#a3787938
Sent from the ActiveMQ - User forum at Nabble.com.


Re: Transaction Retry Problems (AMQ4 Snapshot)

Posted by John Pederzolli <jp...@gmail.com>.
Also - this was running the latest SNAPSHOT from 04/06/06
--
View this message in context: http://www.nabble.com/Transaction-Retry-Problems-%28AMQ4-Snapshot%29-t1406942.html#a3865538
Sent from the ActiveMQ - User forum at Nabble.com.


Re: Transaction Retry Problems (AMQ4 Snapshot)

Posted by John Pederzolli <jp...@gmail.com>.
So I assume by your example you are using Spring's JmsTransactionManager?

I was just using Jencks to control retrys by the consumer - maybe thats the
issue?

Do you have an xml configuration snippet that shows the 2 being used
together to accomplish retrys? I havent had any luck yet.

Thanks again - John
--
View this message in context: http://www.nabble.com/Transaction-Retry-Problems-%28AMQ4-RC3%29-t1406942.html#a3906171
Sent from the ActiveMQ - User forum at Nabble.com.


Re: Transaction Retry Problems (AMQ4 Snapshot)

Posted by "Christopher G. Stach II" <cg...@ldsys.net>.
John Pederzolli wrote:
> 
> Christopher G. Stach II wrote:
>> What happens if you just mark the Tx for rollback instead of throwing a
>> RuntimeException?
>>
> 
> Christopher -
> 
> How exactly would I do that?
> 
> I currently am consuming messages via Jencks and an MDP, so I'm not sure how
> I would accomplish that.
> 
> Any help would be appreciated 
> 
> - John
> 
> 
> --
> View this message in context: http://www.nabble.com/Transaction-Retry-Problems-%28AMQ4-RC3%29-t1406942.html#a3905086
> Sent from the ActiveMQ - User forum at Nabble.com.
> 

If you're generating the RuntimeException manually (explicitly throwing
it to cause this problem), replace it with something like:

Transaction transaction = _transactionManager.getTransaction();

transaction.setRollbackOnly();

(I don't know where you'll get _transactionManager from...)

If you're using Spring, it's easier:

TransactionInterceptor.currentTransactionStatus().setRollbackOnly();

If you're NOT generating the exception manually, just catch the
exception and do one of the above.

-- 
Christopher G. Stach II

Re: Transaction Retry Problems (AMQ4 Snapshot)

Posted by John Pederzolli <jp...@gmail.com>.

Christopher G. Stach II wrote:
> 
> What happens if you just mark the Tx for rollback instead of throwing a
> RuntimeException?
> 

Christopher -

How exactly would I do that?

I currently am consuming messages via Jencks and an MDP, so I'm not sure how
I would accomplish that.

Any help would be appreciated 

- John


--
View this message in context: http://www.nabble.com/Transaction-Retry-Problems-%28AMQ4-RC3%29-t1406942.html#a3905086
Sent from the ActiveMQ - User forum at Nabble.com.


Re: Transaction Retry Problems (AMQ4 Snapshot)

Posted by "Christopher G. Stach II" <cg...@ldsys.net>.
John Pederzolli wrote:
> I updated to RC3 and now get quite the opposite effect. if I send 100
> messages and cause 20 to fail via a runtimeexception, messages (Im assuming
> the ones that failed and shouldve been retried) get reprocessed over and
> over, i.e. if I send 100 messages and the consumer writes them to a
> database, I end up getting well over 100 entries in the database. This error
> shows up many times in the logs - which definitely looks like a bug:
> 
> [ERROR] 2006-04-13 09:34:12,728  -
> org.apache.activemq.ra.ServerSessionPoolImpl
> (ServerSessionPoolImpl.java:178)- Error redispatching unconsumed messages
> from stale session
> java.lang.NullPointerException
> 	at
> org.apache.activemq.ra.ServerSessionPoolImpl.createServerSessionImpl(ServerSessionPoolImpl.java:60)
> 	at
> org.apache.activemq.ra.ServerSessionPoolImpl.getServerSession(ServerSessionPoolImpl.java:113)
> 	at
> org.apache.activemq.ra.ServerSessionPoolImpl.dispatchToSession(ServerSessionPoolImpl.java:135)
> 	at
> org.apache.activemq.ra.ServerSessionPoolImpl.removeFromPool(ServerSessionPoolImpl.java:175)
> 	at org.apache.activemq.ra.ServerSessionImpl.run(ServerSessionImpl.java:177)
> 	at
> org.apache.geronimo.connector.work.WorkerContext.run(WorkerContext.java:291)
> 	at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown
> Source)
> 	at java.lang.Thread.run(Thread.java:595)
> --
> View this message in context: http://www.nabble.com/Transaction-Retry-Problems-%28AMQ4-RC3%29-t1406942.html#a3904140
> Sent from the ActiveMQ - User forum at Nabble.com.
> 

What happens if you just mark the Tx for rollback instead of throwing a
RuntimeException?

-- 
Christopher G. Stach II

Re: Transaction Retry Problems (AMQ4 Snapshot)

Posted by John Pederzolli <jp...@gmail.com>.
I updated to RC3 and now get quite the opposite effect. if I send 100
messages and cause 20 to fail via a runtimeexception, messages (Im assuming
the ones that failed and shouldve been retried) get reprocessed over and
over, i.e. if I send 100 messages and the consumer writes them to a
database, I end up getting well over 100 entries in the database. This error
shows up many times in the logs - which definitely looks like a bug:

[ERROR] 2006-04-13 09:34:12,728  -
org.apache.activemq.ra.ServerSessionPoolImpl
(ServerSessionPoolImpl.java:178)- Error redispatching unconsumed messages
from stale session
java.lang.NullPointerException
	at
org.apache.activemq.ra.ServerSessionPoolImpl.createServerSessionImpl(ServerSessionPoolImpl.java:60)
	at
org.apache.activemq.ra.ServerSessionPoolImpl.getServerSession(ServerSessionPoolImpl.java:113)
	at
org.apache.activemq.ra.ServerSessionPoolImpl.dispatchToSession(ServerSessionPoolImpl.java:135)
	at
org.apache.activemq.ra.ServerSessionPoolImpl.removeFromPool(ServerSessionPoolImpl.java:175)
	at org.apache.activemq.ra.ServerSessionImpl.run(ServerSessionImpl.java:177)
	at
org.apache.geronimo.connector.work.WorkerContext.run(WorkerContext.java:291)
	at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(Unknown
Source)
	at java.lang.Thread.run(Thread.java:595)
--
View this message in context: http://www.nabble.com/Transaction-Retry-Problems-%28AMQ4-RC3%29-t1406942.html#a3904140
Sent from the ActiveMQ - User forum at Nabble.com.


Re: Transaction Retry Problems (AMQ4 Snapshot)

Posted by John Pederzolli <jp...@gmail.com>.
This looks like another synchronization issue which is a little difficult to
reproduce as a unit test. I am using Jencks 1.1.3 which I cant rule out as
the source of the problem; but basically all I have to do to reproduce this
in the container is to write client that loops and sends 100 messages then
cause a failure to occur periodically w/ a RuntimeException thrown in the
MDP... I will see if I can get anything more specific.
--
View this message in context: http://www.nabble.com/Transaction-Retry-Problems-%28AMQ4-Snapshot%29-t1406942.html#a3854996
Sent from the ActiveMQ - User forum at Nabble.com.


Re: Transaction Retry Problems (AMQ4 Snapshot)

Posted by Hiram Chirino <hi...@hiramchirino.com>.
How old is your snapshot, and is it easy to reproduce?

On 4/10/06, John Pederzolli <jp...@gmail.com> wrote:
>
> This exception also comes up a couple times before messages cease being
> consumed
>
> [INFO] 2006-04-10 09:43:28,258  -
> apache.activemq.broker.AbstractConnection.Service
> (AbstractConnection.java:199)- Sync error occurred:
> java.lang.NullPointerException
> java.lang.NullPointerException
>         at
> org.apache.activemq.broker.TransactionBroker.getTransaction(TransactionBroker.java:218)
>         at
> org.apache.activemq.broker.TransactionBroker.commitTransaction(TransactionBroker.java:152)
>         at
> org.apache.activemq.broker.BrokerFilter.commitTransaction(BrokerFilter.java:77)
>         at
> org.apache.activemq.broker.BrokerFilter.commitTransaction(BrokerFilter.java:77)
>         at
> org.apache.activemq.broker.MutableBrokerFilter.commitTransaction(MutableBrokerFilter.java:89)
>         at
> org.apache.activemq.broker.AbstractConnection.processCommitTransactionOnePhase(AbstractConnection.java:297)
>         at
> org.apache.activemq.command.TransactionInfo.visit(TransactionInfo.java:98)
>         at
> org.apache.activemq.broker.AbstractConnection.service(AbstractConnection.java:196)
>         at
> org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:62)
>         at
> org.apache.activemq.transport.ResponseCorrelator.onCommand(ResponseCorrelator.java:88)
>         at
> org.apache.activemq.transport.TransportFilter.onCommand(TransportFilter.java:70)
>         at
> org.apache.activemq.transport.WireFormatNegotiator.onCommand(WireFormatNegotiator.java:114)
>         at
> org.apache.activemq.transport.InactivityMonitor.onCommand(InactivityMonitor.java:122)
>         at
> org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:87)
>         at
> org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:139)
>         at java.lang.Thread.run(Thread.java:595)
> --
> View this message in context: http://www.nabble.com/Transaction-Retry-Problems-%28AMQ4-Snapshot%29-t1406942.html#a3845709
> Sent from the ActiveMQ - User forum at Nabble.com.
>
>


--
Regards,
Hiram

Re: Transaction Retry Problems (AMQ4 Snapshot)

Posted by John Pederzolli <jp...@gmail.com>.
This exception also comes up a couple times before messages cease being
consumed

[INFO] 2006-04-10 09:43:28,258  -
apache.activemq.broker.AbstractConnection.Service
(AbstractConnection.java:199)- Sync error occurred:
java.lang.NullPointerException
java.lang.NullPointerException
	at
org.apache.activemq.broker.TransactionBroker.getTransaction(TransactionBroker.java:218)
	at
org.apache.activemq.broker.TransactionBroker.commitTransaction(TransactionBroker.java:152)
	at
org.apache.activemq.broker.BrokerFilter.commitTransaction(BrokerFilter.java:77)
	at
org.apache.activemq.broker.BrokerFilter.commitTransaction(BrokerFilter.java:77)
	at
org.apache.activemq.broker.MutableBrokerFilter.commitTransaction(MutableBrokerFilter.java:89)
	at
org.apache.activemq.broker.AbstractConnection.processCommitTransactionOnePhase(AbstractConnection.java:297)
	at
org.apache.activemq.command.TransactionInfo.visit(TransactionInfo.java:98)
	at
org.apache.activemq.broker.AbstractConnection.service(AbstractConnection.java:196)
	at
org.apache.activemq.broker.TransportConnection$1.onCommand(TransportConnection.java:62)
	at
org.apache.activemq.transport.ResponseCorrelator.onCommand(ResponseCorrelator.java:88)
	at
org.apache.activemq.transport.TransportFilter.onCommand(TransportFilter.java:70)
	at
org.apache.activemq.transport.WireFormatNegotiator.onCommand(WireFormatNegotiator.java:114)
	at
org.apache.activemq.transport.InactivityMonitor.onCommand(InactivityMonitor.java:122)
	at
org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:87)
	at
org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:139)
	at java.lang.Thread.run(Thread.java:595)
--
View this message in context: http://www.nabble.com/Transaction-Retry-Problems-%28AMQ4-Snapshot%29-t1406942.html#a3845709
Sent from the ActiveMQ - User forum at Nabble.com.