You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pulsar.apache.org by GitBox <gi...@apache.org> on 2018/02/08 22:32:02 UTC

[GitHub] merlimat closed pull request #1203: Use duplicates when writing from ByteBuf pair to avoid multiple threads issues

merlimat closed pull request #1203: Use duplicates when writing from ByteBuf pair to avoid multiple threads issues
URL: https://github.com/apache/incubator-pulsar/pull/1203
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/pulsar-common/src/main/java/org/apache/pulsar/common/api/ByteBufPair.java b/pulsar-common/src/main/java/org/apache/pulsar/common/api/ByteBufPair.java
index 297b56276..94e1fb7b1 100644
--- a/pulsar-common/src/main/java/org/apache/pulsar/common/api/ByteBufPair.java
+++ b/pulsar-common/src/main/java/org/apache/pulsar/common/api/ByteBufPair.java
@@ -121,8 +121,8 @@ public void write(ChannelHandlerContext ctx, Object msg, ChannelPromise promise)
                 // ByteBuf are automatically released after a write. If the ByteBufPair ref count is increased and it
                 // gets written multiple times, the individual buffers refcount should be reflected as well.
                 try {
-                    ctx.write(b.getFirst().retain(), ctx.voidPromise());
-                    ctx.write(b.getSecond().retain(), promise);
+                    ctx.write(b.getFirst().retainedDuplicate(), ctx.voidPromise());
+                    ctx.write(b.getSecond().retainedDuplicate(), promise);
                 } finally {
                     ReferenceCountUtil.safeRelease(b);
                 }


 

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services