-
Notifications
You must be signed in to change notification settings - Fork 28.6k
[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
Conversation
Modifid ShuffleBlockFetcherIterator to close block data file
QA tests have started for PR 2408 at commit
|
channel = new RandomAccessFile(file, "r").getChannel | ||
channel.map(MapMode.READ_ONLY, offset, length) | ||
} finally { | ||
channel.close() |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
…before invoking channel.close
QA tests have started for PR 2408 at commit
|
QA tests have finished for PR 2408 at commit
|
QA tests have finished for PR 2408 at commit
|
QA tests have started for PR 2408 at commit
|
QA tests have finished for PR 2408 at commit
|
)) | ||
} finally { | ||
if (is != null) { | ||
is.close() |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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.
ecfaa40
to
830500e
Compare
830500e
to
074781d
Compare
Jenkins, test this please. |
test this please. |
QA tests have started for PR 2408 at commit
|
QA tests have finished for PR 2408 at commit
|
Thanks. Merging in master. |
No description provided.