From 14e83faa1bf5523d63755ec54f42cbc1d21affc6 Mon Sep 17 00:00:00 2001 From: Clebert Suconic Date: Thu, 25 Apr 2024 11:25:37 -0400 Subject: [PATCH] ARTEMIS-4750 AMQP Large Message flow control to use runAfter The resume delivery on AMQP Large Message Writer is using runNow. When a flow control is paused and then resumed, the runNow will make the first read to happen inline to the thread that's resuming other deliveries. It would be better to not run the delivery within the same call. Hence the change here is simple, being just using a connection.runLater instead of runNow. I have seen this on a thread dump from a production server. No semantic issues were encountered but there was a theory that the Netty thread responsible to resume would be busy with a delivery when not supposed to. Better to be safe on this case. --- .../artemis/protocol/amqp/proton/AMQPLargeMessageWriter.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/AMQPLargeMessageWriter.java b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/AMQPLargeMessageWriter.java index d6fccce451..b2cffb483b 100644 --- a/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/AMQPLargeMessageWriter.java +++ b/artemis-protocols/artemis-amqp-protocol/src/main/java/org/apache/activemq/artemis/protocol/amqp/proton/AMQPLargeMessageWriter.java @@ -166,7 +166,7 @@ public class AMQPLargeMessageWriter implements MessageWriter { * Used to provide re-entry from the flow control executor when IO back-pressure has eased */ private void resume() { - connection.runNow(this::tryDelivering); + connection.runLater(this::tryDelivering); } private void tryDelivering() {