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

    https://github.com/apache/spark/pull/4944#discussion_r26256855
  
    --- 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 --
    
    I'm not too familiar with this API - but can this connection object ever 
leak even if the returned input-stream is closed? Or, can an exception occur 
before returning from this method and the connection leak that way? I'm 
guessing these aren't possible but just wanted to educate myself as to how 
these scenarios won't happen =)


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