Github user JoshRosen commented on a diff in the pull request:
https://github.com/apache/spark/pull/6423#discussion_r31370405
--- Diff:
core/src/main/scala/org/apache/spark/storage/ShuffleBlockFetcherIterator.scala
---
@@ -313,6 +303,33 @@ final class ShuffleBlockFetcherIterator(
}
}
+// Helper class that ensures a ManagedBuffer is released on
InputStream.close()
+private class WrappedInputStream(
+ delegate: InputStream, buf: ManagedBuffer, var
currentResult: FetchResult)
+ extends InputStream {
+
+ override def read(): Int = delegate.read()
+
+ override def close(): Unit = {
+ delegate.close()
--- End diff --
Our overridden close method needs to be idempotent (since non-idempotent
close() methods have been a frequent source of bugs). I'd add an `if(!closed)`
to guard this so that `release()` isn't called twice on a double-close.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]