[1/2] activemq-artemis git commit: ARTEMIS-1601 deal with race in Stomp sendMessage

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[1/2] activemq-artemis git commit: ARTEMIS-1601 deal with race in Stomp sendMessage

jbertram
Repository: activemq-artemis
Updated Branches:
  refs/heads/master 499273bd6 -> 7377ef7f6


ARTEMIS-1601 deal with race in Stomp sendMessage

If the Stomp consumer was closed at or near the same time a message was
dispatched then an NPE might result. Throwing an exception is a
relatively expensive operation in the JVM because of the stacktrace
information that needs to be generated, so in cases where it is known
that a null value could be returned one should check and handle it
appropriately.


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/b8f591b6
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/b8f591b6
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/b8f591b6

Branch: refs/heads/master
Commit: b8f591b6b9b84cbea599db95c6b743a2c4088319
Parents: 499273b
Author: jostbg <[hidden email]>
Authored: Thu Jan 11 12:16:35 2018 +0100
Committer: Justin Bertram <[hidden email]>
Committed: Thu Jan 11 11:42:56 2018 -0600

----------------------------------------------------------------------
 .../apache/activemq/artemis/core/protocol/stomp/StompSession.java | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/activemq-artemis/blob/b8f591b6/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompSession.java
----------------------------------------------------------------------
diff --git a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompSession.java b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompSession.java
index 33f5c7a..e188e75 100644
--- a/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompSession.java
+++ b/artemis-protocols/artemis-stomp-protocol/src/main/java/org/apache/activemq/artemis/core/protocol/stomp/StompSession.java
@@ -138,6 +138,9 @@ public class StompSession implements SessionCallback {
       ICoreMessage newServerMessage = serverMessage.toCore();
       try {
          StompSubscription subscription = subscriptions.get(consumer.getID());
+         // subscription might be null if the consumer was closed
+         if (subscription == null)
+            return 0;
          StompFrame frame;
          ActiveMQBuffer buffer;
 

Reply | Threaded
Open this post in threaded view
|

[2/2] activemq-artemis git commit: This closes #1772

jbertram
This closes #1772


Project: http://git-wip-us.apache.org/repos/asf/activemq-artemis/repo
Commit: http://git-wip-us.apache.org/repos/asf/activemq-artemis/commit/7377ef7f
Tree: http://git-wip-us.apache.org/repos/asf/activemq-artemis/tree/7377ef7f
Diff: http://git-wip-us.apache.org/repos/asf/activemq-artemis/diff/7377ef7f

Branch: refs/heads/master
Commit: 7377ef7f6d652aefe0542aaf3602957d9c848b7d
Parents: 499273b b8f591b
Author: Justin Bertram <[hidden email]>
Authored: Thu Jan 11 11:43:19 2018 -0600
Committer: Justin Bertram <[hidden email]>
Committed: Thu Jan 11 11:43:19 2018 -0600

----------------------------------------------------------------------
 .../apache/activemq/artemis/core/protocol/stomp/StompSession.java | 3 +++
 1 file changed, 3 insertions(+)
----------------------------------------------------------------------