rickyma commented on PR #1522:
URL: 
https://github.com/apache/incubator-uniffle/pull/1522#issuecomment-1938215886

   > What if we would make sure that `this.buffer.release()` is called at most 
once?
   > 
   > ```
   >   private boolean released = false;
   > 
   >   public synchronized void release() {
   >     if (! released && this.buffer != null) {
   >       this.buffer.release();
   >       released = true;
   >     }
   >   }
   > ```
   > 
   > Then we wouldn't need to add logic that requires internal knowledge of 
`this.buffer.release()`.
   
   Your approach might not solve this issue. Because my previous code was 
written in a similar way to yours.
   Currently, methods `ShuffleDataResult.release()` and 
`ShuffleIndexResult.release()` are called only once(at least, that's what the 
code suggests.), but `IllegalReferenceCountException` will still arise in 
extremely rare scenarios occasionally(not always). That means the `refCnt` of 
`ByteBuf` inside `ShuffleDataResult` and `ShuffleIndexResult` is already 0 when 
the first time methods `ShuffleDataResult.release()` and 
`ShuffleIndexResult.release()` are called. 
   
   The cause is unclear at the moment, we can investigate further in the 
future. But at least for now, the changes I've made will definitely not cause 
any problems.


-- 
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]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to