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

    https://github.com/apache/spark/pull/15652#discussion_r88137680
  
    --- Diff: core/src/main/scala/org/apache/spark/ui/JettyUtils.scala ---
    @@ -307,15 +307,26 @@ private[spark] object JettyUtils extends Logging {
           connectors += httpConnector
     
           sslOptions.createJettySslContextFactory().foreach { factory =>
    -        // If the new port wraps around, do not try a privileged port.
    +
    +        require(sslOptions.port == 0 || (1024 <= sslOptions.port && 
sslOptions.port < 65536),
    +          "securePort should be between 1024 and 65535 (inclusive)," +
    +            " or 0 for determined automatically.")
    +
             val securePort =
               if (currentPort != 0) {
    -            (currentPort + 400 - 1024) % (65536 - 1024) + 1024
    +            if (sslOptions.port == 0) {
    --- End diff --
    
    There's a problem with this logic. It ignores retries. Imagine that you're 
setting the base HTTP and SSL ports for the Spark UI (not for the history 
server), and you want multiple drivers on the same host. So you set (names may 
not be totally correct):
    
        spark.ui.port=1234
        spark.ssl.ui.port=5678
    
    The first driver comes up and binds to 1234 and 5678. Then the second 
driver comes up and those two ports are used; `startServiceOnPort` will take 
care of retrying the HTTP port until `maxRetries`, but this code does not do 
the same for the SSL port: it will always try `5678`. So the second driver will 
never run because it will fail to bind to the SSL port.
    
    You should instead be using the `port` value passed to `startServiceOnPort` 
as the base to calculate the offset for the defined SSL port. That's not 
optimal, but it's probably the best you can do 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 [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