-
Notifications
You must be signed in to change notification settings - Fork 29k
SPARK-16420: Ensure compression streams are closed. #14093
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
SPARK-16420: Ensure compression streams are closed. #14093
Conversation
| ByteStreams.copy(partitionInputStream, mergedFileOutputStream); | ||
| innerThrewException = false; | ||
| } finally { | ||
| Closeables.close(partitionInputStream, innerThrewException); |
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.
Not that it matters much, but what about also using the Utils.tryWithSafeFinally pattern here for some consistency?
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 is the usual equivalent for Java code.
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.
Oh duh it's Java. I have made that mistake about 10 times now
|
Test build #61916 has finished for PR 14093 at commit
|
This adds an option to LimitedInputStream to not close the underlying stream when it is reused, which is the case in UnsafeShuffleWriter.
|
Test build #61926 has finished for PR 14093 at commit
|
| left -= skipped; | ||
| return skipped; | ||
| } | ||
| @Override |
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.
add a blank line here?
|
cc @JoshRosen |
|
LGTM pending Jenkins. |
|
Test build #61988 has finished for PR 14093 at commit
|
|
Merging in master/2.0. |
## What changes were proposed in this pull request? This uses the try/finally pattern to ensure streams are closed after use. `UnsafeShuffleWriter` wasn't closing compression streams, causing them to leak resources until garbage collected. This was causing a problem with codecs that use off-heap memory. ## How was this patch tested? Current tests are sufficient. This should not change behavior. Author: Ryan Blue <blue@apache.org> Closes #14093 from rdblue/SPARK-16420-unsafe-shuffle-writer-leak. (cherry picked from commit 67e085e) Signed-off-by: Reynold Xin <rxin@databricks.com>
What changes were proposed in this pull request?
This uses the try/finally pattern to ensure streams are closed after use.
UnsafeShuffleWriterwasn't closing compression streams, causing them to leak resources until garbage collected. This was causing a problem with codecs that use off-heap memory.How was this patch tested?
Current tests are sufficient. This should not change behavior.