You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@activemq.apache.org by "Markus Gerstel (JIRA)" <ji...@apache.org> on 2017/06/02 16:37:04 UTC
[jira] [Comment Edited] (AMQ-6697) Aborting a STOMP 1.1 transaction
after ACK/NACK leads to invalid state
[ https://issues.apache.org/jira/browse/AMQ-6697?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16035010#comment-16035010 ]
Markus Gerstel edited comment on AMQ-6697 at 6/2/17 4:36 PM:
-------------------------------------------------------------
Got it.
{code}
diff --git a/activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/Stomp11Test.java b/activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/Stomp11Test.java
index f61c899..f4ce712 100644
--- a/activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/Stomp11Test.java
+++ b/activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/Stomp11Test.java
@@ -1150,7 +1150,7 @@ public class Stomp11Test extends StompTestSupport {
stompConnection.sendFrame(frame);
frame = "SUBSCRIBE\n" + "destination:/queue/" + getQueueName() + "\n" +
- "id:12345\n" + "ack:client\n\n" + Stomp.NULL;
+ "id:12345\n" + "ack:client-individual\n\n" + Stomp.NULL;
stompConnection.sendFrame(frame);
StompFrame received = stompConnection.receive();
{code}
leads to
{quote}
Tests run: 28, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 90.347 sec <<< FAILURE! - in org.apache.activemq.transport.stomp.Stomp11NIOSSLTest
testTransactionRollbackAllowsSecondAckOutsideTX(org.apache.activemq.transport.stomp.Stomp11NIOSSLTest) Time elapsed: 30.193 sec <<< FAILURE!
java.lang.AssertionError: Message not ack'd
at org.junit.Assert.fail(Assert.java:88)
at org.junit.Assert.assertTrue(Assert.java:41)
at org.apache.activemq.transport.stomp.Stomp11Test.testTransactionRollbackAllowsSecondAckOutsideTX(Stomp11Test.java:1175)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:298)
at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:292)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.lang.Thread.run(Thread.java:745)
{quote}
was (Author: mgerstel):
Got it.
{code}
diff --git a/activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/Stomp11Test.java b/activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/Stomp11Test.java
index f61c899..f4ce712 100644
--- a/activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/Stomp11Test.java
+++ b/activemq-stomp/src/test/java/org/apache/activemq/transport/stomp/Stomp11Test.java
@@ -1150,7 +1150,7 @@ public class Stomp11Test extends StompTestSupport {
stompConnection.sendFrame(frame);
frame = "SUBSCRIBE\n" + "destination:/queue/" + getQueueName() + "\n" +
- "id:12345\n" + "ack:client\n\n" + Stomp.NULL;
+ "id:12345\n" + "ack:client-individual\n\n" + Stomp.NULL;
stompConnection.sendFrame(frame);
StompFrame received = stompConnection.receive();
{code}
leads to
{quote}
Tests run: 28, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 90.347 sec <<< FAILURE! - in org.apache.activemq.transport.stomp.Stomp11NIOSSLTest
testTransactionRollbackAllowsSecondAckOutsideTX(org.apache.activemq.transport.stomp.Stomp11NIOSSLTest) Time elapsed: 30.193 sec <<< FAILURE!
java.lang.AssertionError: Message not ack'd
at org.junit.Assert.fail(Assert.java:88)
at org.junit.Assert.assertTrue(Assert.java:41)
at org.apache.activemq.transport.stomp.Stomp11Test.testTransactionRollbackAllowsSecondAckOutsideTX(Stomp11Test.java:1175)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:298)
at org.junit.internal.runners.statements.FailOnTimeout$CallableStatement.call(FailOnTimeout.java:292)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.lang.Thread.run(Thread.java:745)
{quote}
=>
> Aborting a STOMP 1.1 transaction after ACK/NACK leads to invalid state
> ----------------------------------------------------------------------
>
> Key: AMQ-6697
> URL: https://issues.apache.org/jira/browse/AMQ-6697
> Project: ActiveMQ
> Issue Type: Bug
> Components: stomp
> Affects Versions: 5.14.5
> Reporter: Markus Gerstel
>
> Reproducing the problem:
> * Receive a message via STOMP
> * Start a transaction
> * ACK (or NACK) the message within the transaction
> * Abort the transaction
> * ACK (or NACK) the message
> Expected behaviour:
> * The message is according to step #5 either ACKed or NACKed.
> Observed behaviour:
> * The message is neither ACKed nor NACKed, but stays in unacknowledged state
> * An exception is raised:
> org.apache.activemq.transport.stomp.ProtocolException: Unexpected ACK received for message-id [ID:(...)]
> at org.apache.activemq.transport.stomp.ProtocolConverter.onStompAck(ProtocolConverter.java:475)
> at org.apache.activemq.transport.stomp.ProtocolConverter.onStompCommand(ProtocolConverter.java:250)
> at org.apache.activemq.transport.stomp.StompTransportFilter.onCommand(StompTransportFilter.java:85)
> at org.apache.activemq.transport.TransportSupport.doConsume(TransportSupport.java:83)
> at org.apache.activemq.transport.tcp.TcpTransport.doRun(TcpTransport.java:233)
> at org.apache.activemq.transport.tcp.TcpTransport.run(TcpTransport.java:215)
> at java.lang.Thread.run(Thread.java:745)
> * an ERROR message is sent to the client
> As far as I can tell this is caused by code in both onStompAck() and onStompNack():
> https://git-wip-us.apache.org/repos/asf?p=activemq.git;a=blob;f=activemq-stomp/src/main/java/org/apache/activemq/transport/stomp/ProtocolConverter.java;h=b25860bf6895240c33a8643b6fcc731af126d32e;hb=refs/heads/master#l440
> With a STOMP 1.1 ACK/NACK, ackId == null, so the message entry is taken out of this.pedingAcks (sic!).
> When the transaction is aborted the message entry is then not put back into this.pedingAcks, so any subsequent ACK/NACK will find pendingAck==null, therefore acked==false, raising an exception.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)