Github user rxin commented on a diff in the pull request:
https://github.com/apache/spark/pull/2408#discussion_r17617004
--- Diff:
core/src/main/scala/org/apache/spark/storage/ShuffleBlockFetcherIterator.scala
---
@@ -111,10 +112,18 @@ final class ShuffleBlockFetcherIterator(
blockTransferService.fetchBlocks(req.address.host, req.address.port,
blockIds,
new BlockFetchingListener {
override def onBlockFetchSuccess(blockId: String, data:
ManagedBuffer): Unit = {
- results.put(new FetchResult(BlockId(blockId), sizeMap(blockId),
- () => serializer.newInstance().deserializeStream(
- blockManager.wrapForCompression(BlockId(blockId),
data.inputStream())).asIterator
- ))
+ var is: InputStream = null
+ try {
+ is = data.inputStream()
+ results.put(new FetchResult(BlockId(blockId), sizeMap(blockId),
+ () => serializer.newInstance().deserializeStream(
+ blockManager.wrapForCompression(BlockId(blockId),
is)).asIterator
+ ))
+ } finally {
+ if (is != null) {
+ is.close()
--- End diff --
doesn't this close the inputstream prematurely? Note that the 3ard
argument to results is passed in as a closure so it is lazy.
BTW in my new refactoring of this, there is a place where we should
explicitly close the streams:
https://github.com/apache/spark/pull/2330/files#diff-27109eb30a77542d377c936e0d134420R295
---
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]