ptupitsyn commented on a change in pull request #749:
URL: https://github.com/apache/ignite-3/pull/749#discussion_r834277470
##########
File path:
modules/client/src/main/java/org/apache/ignite/internal/client/TcpClientChannel.java
##########
@@ -141,7 +146,12 @@ private void close(Exception cause) {
/** {@inheritDoc} */
@Override
public void onMessage(ByteBuf buf) {
- processNextMessage(buf);
+ try {
+ processNextMessage(buf);
+ } catch (Throwable t) {
+ buf.release();
+ throw t;
+ }
Review comment:
When everything goes well, the buffer is released by the `try` block on
line 247 after decoding the message. The decoding happens later on
`asyncContinuationExecutor`, not on a current thread, so we can't use `finally`
here.
But when there is an exception (unexpected message type, unexpected response
id, etc) we should release the buffer here to avoid the leak, because full
message decoding won't happen.
--
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]