Github user mccheah commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4944#discussion_r26262063
  
    --- Diff: 
repl/src/main/scala/org/apache/spark/repl/ExecutorClassLoader.scala ---
    @@ -71,30 +73,54 @@ class ExecutorClassLoader(conf: SparkConf, classUri: 
String, parent: ClassLoader
         }
       }
     
    +  private def getClassFileInputStreamFromHttpServer(pathInDirectory: 
String): InputStream = {
    +    val url = if (SparkEnv.get.securityManager.isAuthenticationEnabled()) {
    +      val uri = new URI(classUri + "/" + urlEncode(pathInDirectory))
    +      val newuri = Utils.constructURIForAuthentication(uri, 
SparkEnv.get.securityManager)
    +      newuri.toURL
    +    } else {
    +      new URL(classUri + "/" + urlEncode(pathInDirectory))
    +    }
    +    val connection: HttpURLConnection = 
Utils.setupSecureURLConnection(url.openConnection(),
    +      SparkEnv.get.securityManager).asInstanceOf[HttpURLConnection]
    +    // Set the connection timeouts (for testing purposes)
    +    if (httpUrlConnectionTimeoutMillis != -1) {
    +      connection.setConnectTimeout(httpUrlConnectionTimeoutMillis)
    +      connection.setReadTimeout(httpUrlConnectionTimeoutMillis)
    +    }
    +    connection.connect()
    --- End diff --
    
    How about if an exception throws before we return the input stream? In that 
case the input stream is not closed but perhaps the connection is still open?
    
    I'm basically asking, should we have a catch block for Throwable in this 
method after we instantiate the connection to close the connection if we run 
into an Exception before returning the input 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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to