You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2021/01/26 11:35:08 UTC

[GitHub] [spark] LuciferYang opened a new pull request #31345: [SPARK-34224][CORE][SQL][SS][DSTREAM][YARN][TEST][EXAMPLES][2.4] Ensure all resource opened by `Source.fromXXX` are closed

LuciferYang opened a new pull request #31345:
URL: https://github.com/apache/spark/pull/31345


   ### 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
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #31345: [SPARK-34224][CORE][SQL][SS][DSTREAM][YARN][TEST][EXAMPLES][2.4] Ensure all resource opened by `Source.fromXXX` are closed

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #31345:
URL: https://github.com/apache/spark/pull/31345#issuecomment-767494173


   **[Test build #134500 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/134500/testReport)** for PR 31345 at commit [`8606a1d`](https://github.com/apache/spark/commit/8606a1d48b8c4cdc07fc5ad3f1f400decd9fb821).
    * This patch **fails to build**.
    * This patch merges cleanly.
    * This patch adds no public classes.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] LuciferYang commented on pull request #31345: [SPARK-34224][CORE][SQL][SS][DSTREAM][YARN][TEST][EXAMPLES][2.4] Ensure all resource opened by `Source.fromXXX` are closed

Posted by GitBox <gi...@apache.org>.
LuciferYang commented on pull request #31345:
URL: https://github.com/apache/spark/pull/31345#issuecomment-767542770


   OK, I will close this pr, thx ~ @HyukjinKwon 


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins removed a comment on pull request #31345: [SPARK-34224][CORE][SQL][SS][DSTREAM][YARN][TEST][EXAMPLES][2.4] Ensure all resource opened by `Source.fromXXX` are closed

Posted by GitBox <gi...@apache.org>.
AmplabJenkins removed a comment on pull request #31345:
URL: https://github.com/apache/spark/pull/31345#issuecomment-767509600






----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA removed a comment on pull request #31345: [SPARK-34224][CORE][SQL][SS][DSTREAM][YARN][TEST][EXAMPLES][2.4] Ensure all resource opened by `Source.fromXXX` are closed

Posted by GitBox <gi...@apache.org>.
SparkQA removed a comment on pull request #31345:
URL: https://github.com/apache/spark/pull/31345#issuecomment-767490793


   **[Test build #134500 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/134500/testReport)** for PR 31345 at commit [`8606a1d`](https://github.com/apache/spark/commit/8606a1d48b8c4cdc07fc5ad3f1f400decd9fb821).


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] LuciferYang commented on pull request #31345: [SPARK-34224][CORE][SQL][SS][DSTREAM][YARN][TEST][EXAMPLES][2.4] Ensure all resource opened by `Source.fromXXX` are closed

Posted by GitBox <gi...@apache.org>.
LuciferYang commented on pull request #31345:
URL: https://github.com/apache/spark/pull/31345#issuecomment-767534692


   @HyukjinKwon Is there any other suggestion besides using the  `try {} finally {}` instead?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] HyukjinKwon commented on pull request #31345: [SPARK-34224][CORE][SQL][SS][DSTREAM][YARN][TEST][EXAMPLES][2.4] Ensure all resource opened by `Source.fromXXX` are closed

Posted by GitBox <gi...@apache.org>.
HyukjinKwon commented on pull request #31345:
URL: https://github.com/apache/spark/pull/31345#issuecomment-767543645


   Thank you @LuciferYang :-)


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] HyukjinKwon commented on pull request #31345: [SPARK-34224][CORE][SQL][SS][DSTREAM][YARN][TEST][EXAMPLES][2.4] Ensure all resource opened by `Source.fromXXX` are closed

Posted by GitBox <gi...@apache.org>.
HyukjinKwon commented on pull request #31345:
URL: https://github.com/apache/spark/pull/31345#issuecomment-767529994


   @LuciferYang can you fix the build please?


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] AmplabJenkins commented on pull request #31345: [SPARK-34224][CORE][SQL][SS][DSTREAM][YARN][TEST][EXAMPLES][2.4] Ensure all resource opened by `Source.fromXXX` are closed

Posted by GitBox <gi...@apache.org>.
AmplabJenkins commented on pull request #31345:
URL: https://github.com/apache/spark/pull/31345#issuecomment-767509600






----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] HyukjinKwon commented on pull request #31345: [SPARK-34224][CORE][SQL][SS][DSTREAM][YARN][TEST][EXAMPLES][2.4] Ensure all resource opened by `Source.fromXXX` are closed

Posted by GitBox <gi...@apache.org>.
HyukjinKwon commented on pull request #31345:
URL: https://github.com/apache/spark/pull/31345#issuecomment-767541430


   Ah, I see .. let's just drop this then. I think it's not worthwhile if we have to introduce some diff.


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] LuciferYang commented on pull request #31345: [SPARK-34224][CORE][SQL][SS][DSTREAM][YARN][TEST][EXAMPLES][2.4] Ensure all resource opened by `Source.fromXXX` are closed

Posted by GitBox <gi...@apache.org>.
LuciferYang commented on pull request #31345:
URL: https://github.com/apache/spark/pull/31345#issuecomment-767543627


   If I find a low-cost way, I will reopen this pr


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] LuciferYang closed pull request #31345: [SPARK-34224][CORE][SQL][SS][DSTREAM][YARN][TEST][EXAMPLES][2.4] Ensure all resource opened by `Source.fromXXX` are closed

Posted by GitBox <gi...@apache.org>.
LuciferYang closed pull request #31345:
URL: https://github.com/apache/spark/pull/31345


   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] LuciferYang commented on a change in pull request #31345: [SPARK-34224][CORE][SQL][SS][DSTREAM][YARN][TEST][EXAMPLES][2.4] Ensure all resource opened by `Source.fromXXX` are closed

Posted by GitBox <gi...@apache.org>.
LuciferYang commented on a change in pull request #31345:
URL: https://github.com/apache/spark/pull/31345#discussion_r564446633



##########
File path: core/src/test/scala/org/apache/spark/deploy/master/MasterSuite.scala
##########
@@ -264,16 +265,17 @@ class MasterSuite extends SparkFunSuite
     val conf = new SparkConf()
     val localCluster = new LocalSparkCluster(2, 2, 512, conf)
     localCluster.start()
+    val masterUrl = s"http://localhost:${localCluster.masterWebUIPort}"

Review comment:
       Similar to https://github.com/apache/spark/pull/31344, Not easy to maintain the same format as the master, so added masterUrl(line 268)  

##########
File path: core/src/test/scala/org/apache/spark/deploy/master/MasterSuite.scala
##########
@@ -264,16 +265,17 @@ class MasterSuite extends SparkFunSuite
     val conf = new SparkConf()
     val localCluster = new LocalSparkCluster(2, 2, 512, conf)
     localCluster.start()
+    val masterUrl = s"http://localhost:${localCluster.masterWebUIPort}"

Review comment:
       Similar to https://github.com/apache/spark/pull/31344, Not easy to maintain the same format as the master, so added masterUrl(line 268)  




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] SparkQA commented on pull request #31345: [SPARK-34224][CORE][SQL][SS][DSTREAM][YARN][TEST][EXAMPLES][2.4] Ensure all resource opened by `Source.fromXXX` are closed

Posted by GitBox <gi...@apache.org>.
SparkQA commented on pull request #31345:
URL: https://github.com/apache/spark/pull/31345#issuecomment-767490793


   **[Test build #134500 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/134500/testReport)** for PR 31345 at commit [`8606a1d`](https://github.com/apache/spark/commit/8606a1d48b8c4cdc07fc5ad3f1f400decd9fb821).


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] LuciferYang commented on pull request #31345: [SPARK-34224][CORE][SQL][SS][DSTREAM][YARN][TEST][EXAMPLES][2.4] Ensure all resource opened by `Source.fromXXX` are closed

Posted by GitBox <gi...@apache.org>.
LuciferYang commented on pull request #31345:
URL: https://github.com/apache/spark/pull/31345#issuecomment-767534238


   @HyukjinKwon I'm trying, the problem is `BufferedSource` is not extends `java.io.Closeable` , so the result of  `Source.fromXXX` cannot be an argument to the `Utils. tryWithResource ` method


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org


[GitHub] [spark] HyukjinKwon commented on a change in pull request #31345: [SPARK-34224][CORE][SQL][SS][DSTREAM][YARN][TEST][EXAMPLES][2.4] Ensure all resource opened by `Source.fromXXX` are closed

Posted by GitBox <gi...@apache.org>.
HyukjinKwon commented on a change in pull request #31345:
URL: https://github.com/apache/spark/pull/31345#discussion_r564446905



##########
File path: core/src/test/scala/org/apache/spark/deploy/master/MasterSuite.scala
##########
@@ -264,16 +265,17 @@ class MasterSuite extends SparkFunSuite
     val conf = new SparkConf()
     val localCluster = new LocalSparkCluster(2, 2, 512, conf)
     localCluster.start()
+    val masterUrl = s"http://localhost:${localCluster.masterWebUIPort}"

Review comment:
       It's fine. thanks for the backport PRs




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org