Skip to content

[SPARK-3546] InputStream of ManagedBuffer is not closed and causes running out of file descriptor #2408

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from

Conversation

sarutak
Copy link
Member

@sarutak sarutak commented Sep 16, 2014

No description provided.

Modifid ShuffleBlockFetcherIterator to close block data file
@SparkQA
Copy link

SparkQA commented Sep 16, 2014

QA tests have started for PR 2408 at commit bf29d4a.

  • This patch merges cleanly.

@sarutak sarutak changed the title [SPARK-3546] InputStream of ManagedBuffer does not close and causes running out of file descriptor [SPARK-3546] InputStream of ManagedBuffer is not closed and causes running out of file descriptor Sep 16, 2014
channel = new RandomAccessFile(file, "r").getChannel
channel.map(MapMode.READ_ONLY, offset, length)
} finally {
channel.close()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would throw an NPE if an error occurred in new RandomAccessFile or getChannel. I suppose you move new RandomAccessFile(file, "r").getChannel before the try block. Before that method returns, there is no FileChannel that successfully opened and therefore needs closing.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Originally I was going to check channel is null or not, but I forgot at previous PR.
Now I've modified.

@SparkQA
Copy link

SparkQA commented Sep 16, 2014

QA tests have started for PR 2408 at commit b37231a.

  • This patch merges cleanly.

@SparkQA
Copy link

SparkQA commented Sep 16, 2014

QA tests have finished for PR 2408 at commit bf29d4a.

  • This patch passes unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Sep 16, 2014

QA tests have finished for PR 2408 at commit b37231a.

  • This patch passes unit tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • class ArrayConstructor extends net.razorvine.pickle.objects.ArrayConstructor
    • class SCCallSiteSync(object):

@SparkQA
Copy link

SparkQA commented Sep 16, 2014

QA tests have started for PR 2408 at commit 5f63f67.

  • This patch merges cleanly.

@SparkQA
Copy link

SparkQA commented Sep 16, 2014

QA tests have finished for PR 2408 at commit 5f63f67.

  • This patch passes unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

))
} finally {
if (is != null) {
is.close()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rxin Exactly, it's not make sense and I noticed the InputStream is closed via NextIterator#close.
So, I revert this part of change.

@sarutak sarutak force-pushed the resolve-resource-leak-issue branch from ecfaa40 to 830500e Compare September 16, 2014 18:08
@sarutak sarutak force-pushed the resolve-resource-leak-issue branch from 830500e to 074781d Compare September 16, 2014 18:11
@rxin
Copy link
Contributor

rxin commented Sep 16, 2014

Jenkins, test this please.

@sarutak
Copy link
Member Author

sarutak commented Sep 16, 2014

test this please.

@SparkQA
Copy link

SparkQA commented Sep 16, 2014

QA tests have started for PR 2408 at commit 074781d.

  • This patch merges cleanly.

@SparkQA
Copy link

SparkQA commented Sep 16, 2014

QA tests have finished for PR 2408 at commit 074781d.

  • This patch passes unit tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@rxin
Copy link
Contributor

rxin commented Sep 16, 2014

Thanks. Merging in master.

@asfgit asfgit closed this in a9e9104 Sep 16, 2014
@sarutak sarutak deleted the resolve-resource-leak-issue branch April 11, 2015 05:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants