vanzin commented on a change in pull request #26609: [SPARK-29971] Fix multiple
possible buffer leaks in `TransportFrameDe…
URL: https://github.com/apache/spark/pull/26609#discussion_r348635041
##########
File path:
common/network-common/src/main/java/org/apache/spark/network/util/ByteArrayReadableChannel.java
##########
@@ -45,18 +86,24 @@ public int read(ByteBuffer dst) throws IOException {
if (data.readableBytes() == 0) {
data.release();
+ data = null;
}
return totalRead;
}
@Override
public void close() throws IOException {
+ closed = true;
+ if (data != null) {
+ data.release();
Review comment:
This feels like the wrong place to do it. Shouldn't
`TransportCipher.channelRead` do that instead after it decrypts the buffer?
(Then you also don't need L46.)
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]