Github user mridulm commented on a diff in the pull request:
https://github.com/apache/spark/pull/1722#discussion_r15725700
--- Diff:
core/src/main/scala/org/apache/spark/util/collection/ExternalAppendOnlyMap.scala
---
@@ -455,7 +495,25 @@ class ExternalAppendOnlyMap[K, V, C](
// TODO: Ensure this gets called even if the iterator isn't drained.
private def cleanup() {
- deserializeStream.close()
+ batchIndex = batchOffsets.length // Prevent reading any other batch
+ val ds = deserializeStream
+ val fs = fileStream
+ deserializeStream = null
+ fileStream = null
+
+ if (ds != null) {
+ try {
+ ds.close()
+ } catch {
+ case e: IOException =>
+ // Make sure we at least close the file handle
+ if (fs != null) {
+ try { fs.close() } catch { case e2: IOException => }
--- End diff --
This is just paranoid stuff, you can remove the catch IOException part
actually
The reason it exists is cos we have a Ulimit'ed FileInputStream - which
enforces a ulimit of 8k on spark (which is the fd limit in our clusters).
For large reducers, this prevents task from getting killed.
So this is an attempt to ensure that the stream is truely closed.
I did not realize this had leaked out.
---
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.
---