Skip to content

Conversation

@LuciferYang
Copy link
Contributor

What changes were proposed in this pull request?

Using a function like .mkString or .getLines directly on a scala.io.Source opened by fromFile, fromURL, fromURI will leak the underlying file handle, this pr use the Utils.tryWithResource method wrap the BufferedSource to ensure these BufferedSource closed.

Why are the changes needed?

Avoid file handle leak.

Does this PR introduce any user-facing change?

No

How was this patch tested?

Pass the Jenkins or GitHub Action

@SparkQA
Copy link

SparkQA commented Jan 25, 2021

Test build #134445 has finished for PR 31323 at commit b6bd1f1.

  • This patch fails Scala style tests.
  • This patch merges cleanly.
  • This patch adds no public classes.

@SparkQA
Copy link

SparkQA commented Jan 25, 2021

Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/39033/

@SparkQA
Copy link

SparkQA commented Jan 25, 2021

Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/39031/

@LuciferYang LuciferYang changed the title [SPARK-34224][CORE][TEST] Ensure all resource opened by Source.fromXXX are closed [SPARK-34224][CORE][SQL][SS][DSTREAM][YARN][UI][EXAMPLES] Ensure all resource opened by Source.fromXXX are closed Jan 25, 2021
@LuciferYang LuciferYang changed the title [SPARK-34224][CORE][SQL][SS][DSTREAM][YARN][UI][EXAMPLES] Ensure all resource opened by Source.fromXXX are closed [SPARK-34224][CORE][SQL][SS][DSTREAM][YARN][TEST][EXAMPLES] Ensure all resource opened by Source.fromXXX are closed Jan 25, 2021
@SparkQA
Copy link

SparkQA commented Jan 25, 2021

Kubernetes integration test status failure
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/39031/

@SparkQA
Copy link

SparkQA commented Jan 25, 2021

Kubernetes integration test status failure
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/39033/

@SparkQA
Copy link

SparkQA commented Jan 25, 2021

Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/39035/

@SparkQA
Copy link

SparkQA commented Jan 25, 2021

Test build #134447 has finished for PR 31323 at commit bc30422.

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

@SparkQA
Copy link

SparkQA commented Jan 25, 2021

Kubernetes integration test status failure
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/39035/

@SparkQA
Copy link

SparkQA commented Jan 25, 2021

Test build #134449 has finished for PR 31323 at commit 4a51d20.

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

@LuciferYang
Copy link
Contributor Author

cc @dongjoon-hyun

@HyukjinKwon
Copy link
Member

LGTM otherwise

@SparkQA
Copy link

SparkQA commented Jan 26, 2021

Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/39064/

@SparkQA
Copy link

SparkQA commented Jan 26, 2021

Kubernetes integration test status failure
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/39064/

@SparkQA
Copy link

SparkQA commented Jan 26, 2021

Test build #134478 has finished for PR 31323 at commit 8dfc2b4.

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

@SparkQA
Copy link

SparkQA commented Jan 26, 2021

Kubernetes integration test starting
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/39069/

@SparkQA
Copy link

SparkQA commented Jan 26, 2021

Kubernetes integration test status failure
URL: https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder-K8s/39069/

@SparkQA
Copy link

SparkQA commented Jan 26, 2021

Test build #134483 has finished for PR 31323 at commit 245d844.

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

HyukjinKwon pushed a commit that referenced this pull request Jan 26, 2021
…l resource opened by `Source.fromXXX` are closed

### What changes were proposed in this pull request?
Using a function like `.mkString` or `.getLines` directly on a `scala.io.Source` opened by `fromFile`, `fromURL`, `fromURI ` will leak the underlying file handle,  this pr use the `Utils.tryWithResource` method wrap the `BufferedSource` to ensure these `BufferedSource` closed.

### Why are the changes needed?
Avoid file handle leak.

### Does this PR introduce _any_ user-facing change?
No

### How was this patch tested?
Pass the Jenkins or GitHub Action

Closes #31323 from LuciferYang/source-not-closed.

Authored-by: yangjie01 <yangjie01@baidu.com>
Signed-off-by: HyukjinKwon <gurwls223@apache.org>
(cherry picked from commit 8999e88)
Signed-off-by: HyukjinKwon <gurwls223@apache.org>
@HyukjinKwon
Copy link
Member

Merged to master and branch-3.1.

@LuciferYang, do you mind opening a PR for branch-3.0 and branch-2.4 too?

@LuciferYang
Copy link
Contributor Author

Merged to master and branch-3.1.

@LuciferYang, do you mind opening a PR for branch-3.0 and branch-2.4 too?

OK, will do it later ~

LuciferYang added a commit to LuciferYang/spark that referenced this pull request Jan 26, 2021
…l resource opened by `Source.fromXXX` are closed

Using a function like `.mkString` or `.getLines` directly on a `scala.io.Source` opened by `fromFile`, `fromURL`, `fromURI ` will leak the underlying file handle,  this pr use the `Utils.tryWithResource` method wrap the `BufferedSource` to ensure these `BufferedSource` closed.

Avoid file handle leak.

No

Pass the Jenkins or GitHub Action

Closes apache#31323 from LuciferYang/source-not-closed.

Authored-by: yangjie01 <yangjie01@baidu.com>
Signed-off-by: HyukjinKwon <gurwls223@apache.org>
LuciferYang added a commit to LuciferYang/spark that referenced this pull request Jan 26, 2021
…l resource opened by `Source.fromXXX` are closed

Using a function like `.mkString` or `.getLines` directly on a `scala.io.Source` opened by `fromFile`, `fromURL`, `fromURI ` will leak the underlying file handle,  this pr use the `Utils.tryWithResource` method wrap the `BufferedSource` to ensure these `BufferedSource` closed.

Avoid file handle leak.

No

Pass the Jenkins or GitHub Action

Closes apache#31323 from LuciferYang/source-not-closed.

Authored-by: yangjie01 <yangjie01@baidu.com>
Signed-off-by: HyukjinKwon <gurwls223@apache.org>
@dongjoon-hyun
Copy link
Member

Thank you, @LuciferYang and @HyukjinKwon and @jaceklaskowski !

skestle pushed a commit to skestle/spark that referenced this pull request Feb 3, 2021
…l resource opened by `Source.fromXXX` are closed

### What changes were proposed in this pull request?
Using a function like `.mkString` or `.getLines` directly on a `scala.io.Source` opened by `fromFile`, `fromURL`, `fromURI ` will leak the underlying file handle,  this pr use the `Utils.tryWithResource` method wrap the `BufferedSource` to ensure these `BufferedSource` closed.

### Why are the changes needed?
Avoid file handle leak.

### Does this PR introduce _any_ user-facing change?
No

### How was this patch tested?
Pass the Jenkins or GitHub Action

Closes apache#31323 from LuciferYang/source-not-closed.

Authored-by: yangjie01 <yangjie01@baidu.com>
Signed-off-by: HyukjinKwon <gurwls223@apache.org>
@LuciferYang LuciferYang deleted the source-not-closed branch June 6, 2022 03:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants