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

    https://github.com/apache/spark/pull/4944#discussion_r26367472
  
    --- 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 think that the `connect()` call is unlikely to fail in ways that leak 
resources, but suppose it wouldn't hurt to add another `try-catch` block just 
to be safe.  I can do this tomorrow.


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