-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-22058][CORE]the BufferedInputStream will not be closed if an exception occurs. #19277
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -351,14 +351,14 @@ private[spark] object EventLoggingListener extends Logging { | |
| // Since we sanitize the app ID to not include periods, it is safe to split on it | ||
| val logName = log.getName.stripSuffix(IN_PROGRESS) | ||
| val codecName: Option[String] = logName.split("\\.").tail.lastOption | ||
| val codec = codecName.map { c => | ||
| codecMap.getOrElseUpdate(c, CompressionCodec.createCodec(new SparkConf, c)) | ||
| } | ||
|
|
||
| try { | ||
| val codec = codecName.map { c => | ||
| codecMap.getOrElseUpdate(c, CompressionCodec.createCodec(new SparkConf, c)) | ||
| } | ||
| codec.map(_.compressedInputStream(in)).getOrElse(in) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it better to move this line |
||
| } catch { | ||
| case e: Exception => | ||
| case e: Throwable => | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. What specific case do we want to catch here?
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
with srowen's suggest, we could handle everything include exceptions and errors. |
||
| in.close() | ||
| throw e | ||
| } | ||
|
|
||
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.
Maybe move declaration of
into just before the try