Skip to content

Commit

Permalink
[#1472] fix(client): IlegalReferenceCountException for clientReadHand…
Browse files Browse the repository at this point in the history
…ler.readShuffleData (#1536)

### What changes were proposed in this pull request?

Fix IllegalReferenceCountException issues when exceptions happened in clientReadHandler.readShuffleData().

### Why are the changes needed?

A follow-up PR for: #1522

### Does this PR introduce _any_ user-facing change?

No.

### How was this patch tested?

Existing UTs.
  • Loading branch information
rickyma authored Feb 24, 2024
1 parent 9142516 commit a549028
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,10 @@ private int read() {
// because PlatformDependent.freeDirectBuffer can only release the ByteBuffer with cleaner.
if (sdr != null) {
sdr.release();
// We set sdr to null here to prevent IllegalReferenceCountException that could occur
// if sdr.release() is called multiple times in the close() method,
// when an exception is thrown by clientReadHandler.readShuffleData().
sdr = null;
}
sdr = clientReadHandler.readShuffleData();
readDataTime.addAndGet(System.currentTimeMillis() - start);
Expand Down

0 comments on commit a549028

Please sign in to comment.