Github user scwf commented on the pull request:

    https://github.com/apache/spark/pull/3314#issuecomment-76321222
  
    >>>
     what happens if I explicitly set my spark.ui.port to 5566 but my 
spark.port.max is 1024? There also seems to be a ton of other random ports that 
are affected. Do we need some kind of check to avoid conflicting port settings?
    
    the real spark.ui.port will be 1024, i think here is some problem, my 
initial idea is to make random port follow the specified range, we should 
respect user defined port explicitly(here is 5566). so how about change like 
this:
    
    ```
    val serviceString = if (serviceName.isEmpty) "" else s" '$serviceName'"
        val startPort = conf.getInt("spark.random.port.min", 1024)
        val endPort = conf.getInt("spark.random.port.max", 65536)
        val maxRetries = portMaxRetries(conf)
        for (offset <- 0 to maxRetries) {
          // specific a random port between 'spark.random.port.min' and 
'spark.random.port.max'
          // if port is 0
          val tryPort = if (port == 0) {
            (startPort + Math.random() * (endPort - startPort + 1)).toInt
          } else {
            // If the new port wraps around, do not try a privilege port
            ((port + offset - 1024) % (65536 - 1024)) + 1024
          }
    ```
    



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