[
https://issues.apache.org/jira/browse/ARTEMIS-1098?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15963134#comment-15963134
]
ASF GitHub Bot commented on ARTEMIS-1098:
-----------------------------------------
Github user clebertsuconic commented on a diff in the pull request:
https://github.com/apache/activemq-artemis/pull/1190#discussion_r110703818
--- Diff:
artemis-core-client/src/main/java/org/apache/activemq/artemis/core/protocol/core/impl/ActiveMQSessionContext.java
---
@@ -167,6 +168,36 @@ public ActiveMQSessionContext(String name,
}
}
+ private static int sendSessionSendContinuationMessage(Channel channel,
+ Message msgI,
+ long
messageBodySize,
+ boolean
sendBlocking,
+ boolean lastChunk,
+ byte[] chunk,
+
SendAcknowledgementHandler messageHandler) throws ActiveMQException {
+ final boolean requiresResponse = lastChunk && sendBlocking;
+ final SessionSendContinuationMessage chunkPacket = new
SessionSendContinuationMessage(msgI, chunk, !lastChunk, requiresResponse,
messageBodySize, messageHandler);
+ final int expectedEncodeSize = chunkPacket.expectedEncodeSize();
+ //perform a weak form of flow control to avoid OOM on tight loops
+ final CoreRemotingConnection connection = channel.getConnection();
+ final long blockingCallTimeoutMillis = Math.max(0,
connection.getBlockingCallTimeout());
+ final long startFlowControl = System.nanoTime();
+ final boolean isWritable =
connection.blockUntilWritable(expectedEncodeSize, blockingCallTimeoutMillis);
+ if (!isWritable) {
+ final long endFlowControl = System.nanoTime();
+ final long elapsedFlowControl = endFlowControl - startFlowControl;
+ final long elapsedMillis =
TimeUnit.NANOSECONDS.toMillis(elapsedFlowControl);
+ logger.warn("try to write " + expectedEncodeSize + " bytes after
blocked " + elapsedMillis + " ms on a not writable connection: [" +
connection.getID() + "]");
--- End diff --
last thing Missing... define method through Logger please?
> Improve flow control while streaming large messages
> ---------------------------------------------------
>
> Key: ARTEMIS-1098
> URL: https://issues.apache.org/jira/browse/ARTEMIS-1098
> Project: ActiveMQ Artemis
> Issue Type: Bug
> Reporter: Francesco Nigro
> Priority: Blocker
>
> Improves the sender flow control to avoid OOM issues while streaming huge
> (>=1 GiB) messages with slow receivers/network.
--
This message was sent by Atlassian JIRA
(v6.3.15#6346)