clebertsuconic commented on code in PR #4932:
URL: https://github.com/apache/activemq-artemis/pull/4932#discussion_r1602306503


##########
artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/AMQPLargeMessageWriter.java:
##########
@@ -170,16 +170,26 @@ private void resume() {
    }
 
    private void tryDelivering() {
+
+      final Delivery localDelivery = delivery;
+      final MessageReference localReference = reference;
+      final LargeBodyReader localBodyReader = largeBodyReader;
+
+      if (localDelivery == null || localReference == null || localBodyReader 
== null) {
+         logger.debug("Write got closed before tryDelivering was called");
+         return;
+      }

Review Comment:
   
https://github.com/apache/activemq-artemis/blob/14e83faa1bf5523d63755ec54f42cbc1d21affc6/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/AMQPLargeMessageWriter.java#L126-L134
   
   
   so.. one thread is in resetClose.. another thread is on the tryDeliver...
   
   
   closed is only set to true at the end of the statement...
   
   as a result you could the NPE.
   
   
   you may say set closed first...but still I don't feel like this is 
completely atomic without added synchronization... however I don't want 
synchrnoization here.. just a local copy and checking it should be enough for 
me.
   
   
   I plan to add a test on this.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to