File tree Expand file tree Collapse file tree 2 files changed +17
-3
lines changed
core/src/main/scala/org/apache/spark/util Expand file tree Collapse file tree 2 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -1665,15 +1665,15 @@ private[spark] object Utils extends Logging {
16651665 serviceName : String = " " ,
16661666 maxRetries : Int = portMaxRetries): (T , Int ) = {
16671667 val serviceString = if (serviceName.isEmpty) " " else s " ' $serviceName' "
1668- val startPort = conf.getInt(" spark.port.min" , 0 )
1668+ val startPort = conf.getInt(" spark.port.min" , 1024 )
16691669 val endPort = conf.getInt(" spark.port.max" , 65536 )
16701670 for (offset <- 0 to maxRetries) {
16711671 // Do not increment port if port is 0, which is treated as a special port
16721672 val tryPort = if (port == 0 ) {
16731673 (startPort + Math .random() * (endPort - startPort)).toInt
16741674 } else {
1675- // If the new port wraps around, do not try a privilege port
1676- ((port + offset - 1024 ) % (65536 - 1024 )) + 1024
1675+ // If the new port wraps around, ensure it is in range(startPort, endPort)
1676+ ((port + offset - startPort ) % (endPort - startPort )) + startPort
16771677 }
16781678 try {
16791679 val (service, port) = startService(tryPort)
Original file line number Diff line number Diff line change @@ -183,6 +183,20 @@ of the most common options to set are:
183183 Logs the effective SparkConf as INFO when a SparkContext is started.
184184 </td >
185185</tr >
186+ <tr >
187+ <td ><code >spark.port.min</code ></td >
188+ <td >1024</td >
189+ <td >
190+ Min port for spark(UI, HttpServer. ConnectionManager, Akka)
191+ </td >
192+ </tr >
193+ <tr >
194+ <td ><code >spark.port.max</code ></td >
195+ <td >65536</td >
196+ <td >
197+ Max port for spark(UI, HttpServer. ConnectionManager, Akka)
198+ </td >
199+ </tr >
186200</table >
187201
188202Apart from these, the following properties are also available, and may be useful in some situations:
You can’t perform that action at this time.
0 commit comments