You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by 10110346 <gi...@git.apache.org> on 2017/07/04 01:46:41 UTC

[GitHub] spark pull request #18522: [MINOR]Closes stream and releases any system reso...

GitHub user 10110346 opened a pull request:

    https://github.com/apache/spark/pull/18522

    [MINOR]Closes stream and releases any system resources associated with this stream

    ## What changes were proposed in this pull request?
    
    Closes inputstream or outputstream and releases any system resources associated
    with the stream.
    
    ## How was this patch tested?
    unit test


You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/10110346/spark wip-lx-0703-2

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/spark/pull/18522.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #18522
    
----
commit c0cf41d2d7aeb0d02ed3593464072f3b083f3f6f
Author: liuxian <li...@zte.com.cn>
Date:   2017-07-03T07:34:30Z

    Closes stream and releases any system resources associated with this
    stream

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18522: [MINOR]Closes stream and releases any system resources a...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18522
  
    Merged build finished. Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18522: [CORE][MINOR]Closes stream and releases any syste...

Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:

    https://github.com/apache/spark/pull/18522


---

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


[GitHub] spark pull request #18522: [MINOR]Closes stream and releases any system reso...

Posted by 10110346 <gi...@git.apache.org>.
Github user 10110346 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18522#discussion_r125455468
  
    --- Diff: core/src/main/scala/org/apache/spark/util/logging/FileAppender.scala ---
    @@ -76,7 +76,11 @@ private[spark] class FileAppender(inputStream: InputStream, file: File, bufferSi
               }
             }
           } {
    -        closeFile()
    +        try {
    +          inputStream.close()
    --- End diff --
    
    I referred to `DriverRunner`:
    DriverRunner-->runDriver-->redirectStream-->copyStream, the inputStream is closed in `copyStream`. @srowen


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18522: [CORE][MINOR]Closes stream and releases any system resou...

Posted by 10110346 <gi...@git.apache.org>.
Github user 10110346 commented on the issue:

    https://github.com/apache/spark/pull/18522
  
    `process.getInputStream` is closed in `driverRunner`, but it is not closed in `ExecutorRunner`.
    Which approach is correct?  @jiangxb1987 @srowen 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18522: [MINOR]Closes stream and releases any system reso...

Posted by jiangxb1987 <gi...@git.apache.org>.
Github user jiangxb1987 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18522#discussion_r125378774
  
    --- Diff: core/src/main/scala/org/apache/spark/util/logging/FileAppender.scala ---
    @@ -76,7 +76,11 @@ private[spark] class FileAppender(inputStream: InputStream, file: File, bufferSi
               }
             }
           } {
    -        closeFile()
    +        try {
    +          inputStream.close()
    --- End diff --
    
    AFAIK this inputStream is passed from outside, like `process.getInputStream` in `ExecutorRunner`, so I don't think we should close the inputStream here.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18522: [CORE][MINOR]Closes stream and releases any system resou...

Posted by 10110346 <gi...@git.apache.org>.
Github user 10110346 commented on the issue:

    https://github.com/apache/spark/pull/18522
  
    Thanks @srowen 
    I think it's better to keep the same in `driverRunner` and `ExecutorRunner `. @cloud-fan 


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18522: [MINOR]Closes stream and releases any system resources a...

Posted by AmplabJenkins <gi...@git.apache.org>.
Github user AmplabJenkins commented on the issue:

    https://github.com/apache/spark/pull/18522
  
    Test PASSed.
    Refer to this link for build results (access rights to CI server needed): 
    https://amplab.cs.berkeley.edu/jenkins//job/SparkPullRequestBuilder/79120/
    Test PASSed.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18522: [CORE][MINOR]Closes stream and releases any system resou...

Posted by srowen <gi...@git.apache.org>.
Github user srowen commented on the issue:

    https://github.com/apache/spark/pull/18522
  
    I suspect that this doesn't hurt, because at the point you stop copying input to a file, you are done with the input, and I don't think there is any reason that the caller would ever continue reading it elsewhere. That said, the process is already terminated correctly in this case, which closes the streams too. I'm neutral on it unless this is theoretically solving a problem.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18522: [MINOR]Closes stream and releases any system resources a...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18522
  
    **[Test build #79120 has started](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/79120/testReport)** for PR 18522 at commit [`c0cf41d`](https://github.com/apache/spark/commit/c0cf41d2d7aeb0d02ed3593464072f3b083f3f6f).


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18522: [MINOR]Closes stream and releases any system resources a...

Posted by SparkQA <gi...@git.apache.org>.
Github user SparkQA commented on the issue:

    https://github.com/apache/spark/pull/18522
  
    **[Test build #79120 has finished](https://amplab.cs.berkeley.edu/jenkins/job/SparkPullRequestBuilder/79120/testReport)** for PR 18522 at commit [`c0cf41d`](https://github.com/apache/spark/commit/c0cf41d2d7aeb0d02ed3593464072f3b083f3f6f).
     * This patch passes all tests.
     * This patch merges cleanly.
     * This patch adds no public classes.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18522: [MINOR]Closes stream and releases any system reso...

Posted by srowen <gi...@git.apache.org>.
Github user srowen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18522#discussion_r125451529
  
    --- Diff: core/src/main/scala/org/apache/spark/util/logging/FileAppender.scala ---
    @@ -76,7 +76,11 @@ private[spark] class FileAppender(inputStream: InputStream, file: File, bufferSi
               }
             }
           } {
    -        closeFile()
    +        try {
    +          inputStream.close()
    --- End diff --
    
    It shouldn't be closed here, because the lifecycle of this stream is outside of this class. In practice, the streams used with this class are closed on error anyway.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18522: [MINOR]Closes stream and releases any system reso...

Posted by 10110346 <gi...@git.apache.org>.
Github user 10110346 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18522#discussion_r125380867
  
    --- Diff: core/src/main/scala/org/apache/spark/util/logging/FileAppender.scala ---
    @@ -76,7 +76,11 @@ private[spark] class FileAppender(inputStream: InputStream, file: File, bufferSi
               }
             }
           } {
    -        closeFile()
    +        try {
    +          inputStream.close()
    --- End diff --
    
    The another  reason is that this function runs in another thread


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18522: [MINOR]Closes stream and releases any system reso...

Posted by 10110346 <gi...@git.apache.org>.
Github user 10110346 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18522#discussion_r125379907
  
    --- Diff: core/src/main/scala/org/apache/spark/util/logging/FileAppender.scala ---
    @@ -76,7 +76,11 @@ private[spark] class FileAppender(inputStream: InputStream, file: File, bufferSi
               }
             }
           } {
    -        closeFile()
    +        try {
    +          inputStream.close()
    --- End diff --
    
    Yes,you are right.
    But this function is only used in `ExecutorRunner`,  also if an exception occurs within this function,this will ensure the inputStream  is closed


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18522: [MINOR]Closes stream and releases any system reso...

Posted by 10110346 <gi...@git.apache.org>.
Github user 10110346 commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18522#discussion_r125394310
  
    --- Diff: core/src/test/scala/org/apache/spark/util/UtilsSuite.scala ---
    @@ -488,7 +488,7 @@ class UtilsSuite extends SparkFunSuite with ResetSystemProperties with Logging {
     
       test("resolveURIs with multiple paths") {
         def assertResolves(before: String, after: String): Unit = {
    -      assume(before.split(",").length > 1)
    +      assume(before.split(",").length >= 1)
    --- End diff --
    
    When running UtilsSuite, the following warning occurred:
    
    Test Canceled: 1 was not greater than 1
    org.scalatest.exceptions.TestCanceledException: 1 was not greater than 1
    	at org.scalatest.Assertions$class.newTestCanceledException(Assertions.scala:511)
    	at org.scalatest.FunSuite.newTestCanceledException(FunSuite.scala:1555)
    	at org.scalatest.Assertions$AssertionsHelper.macroAssume(Assertions.scala:481)
    	at org.apache.spark.util.UtilsSuite$$anonfun$19.assertResolves$2(UtilsSuite.scala:491)
    	at org.apache.spark.util.UtilsSuite$$anonfun$19.apply$mcV$sp(UtilsSuite.scala:512)
    	at org.apache.spark.util.UtilsSuite$$anonfun$19.apply(UtilsSuite.scala:489)
    	at org.apache.spark.util.UtilsSuite$$anonfun$19.apply(UtilsSuite.scala:489)


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark issue #18522: [CORE][MINOR]Closes stream and releases any system resou...

Posted by srowen <gi...@git.apache.org>.
Github user srowen commented on the issue:

    https://github.com/apache/spark/pull/18522
  
    I'm not sure that this solves a problem, and has some changes that look unrelated


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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


[GitHub] spark pull request #18522: [MINOR]Closes stream and releases any system reso...

Posted by HyukjinKwon <gi...@git.apache.org>.
Github user HyukjinKwon commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18522#discussion_r125392441
  
    --- Diff: core/src/test/scala/org/apache/spark/util/UtilsSuite.scala ---
    @@ -488,7 +488,7 @@ class UtilsSuite extends SparkFunSuite with ResetSystemProperties with Logging {
     
       test("resolveURIs with multiple paths") {
         def assertResolves(before: String, after: String): Unit = {
    -      assume(before.split(",").length > 1)
    +      assume(before.split(",").length >= 1)
    --- End diff --
    
    BTW, why do we fix this?


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

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