jai1 commented on a change in pull request #1108: Fixed race condition between write operation and send timeout URL: https://github.com/apache/incubator-pulsar/pull/1108#discussion_r163709882
########## File path: pulsar-client/src/main/java/org/apache/pulsar/client/impl/ProducerImpl.java ########## @@ -440,26 +441,28 @@ private boolean canEnqueueRequest(SendCallback callback) { private static final class WriteInEventLoopCallback implements Runnable { private ProducerImpl producer; + private ByteBufPair cmd; + private long sequenceId; private ClientCnx cnx; - private OpSendMsg op; static WriteInEventLoopCallback create(ProducerImpl producer, ClientCnx cnx, OpSendMsg op) { WriteInEventLoopCallback c = RECYCLER.get(); c.producer = producer; c.cnx = cnx; - c.op = op; + c.sequenceId = op.sequenceId; + c.cmd = op.cmd; return c; } @Override public void run() { if (log.isDebugEnabled()) { log.debug("[{}] [{}] Sending message cnx {}, sequenceId {}", producer.topic, producer.producerName, cnx, - op.sequenceId); + sequenceId); } try { - cnx.ctx().writeAndFlush(op.cmd, cnx.ctx().voidPromise()); + cnx.ctx().writeAndFlush(cmd, cnx.ctx().voidPromise()); } finally { Review comment: Don't we need ReferenceCountUtil.safeRelease(cmd); ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services