Skip to content

Commit 6390aae

Browse files
scwfandrewor14
authored andcommitted
[SPARK-3755][Core] Do not bind port 1 - 1024 to server in spark
Non-root user use port 1- 1024 to start jetty server will get the exception " java.net.SocketException: Permission denied", so not use these ports Author: scwf <[email protected]> Closes #2610 from scwf/1-1024 and squashes the following commits: cb8cc76 [scwf] do not use port 1 - 1024
1 parent dcb2f73 commit 6390aae

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

core/src/main/scala/org/apache/spark/util/Utils.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1437,7 +1437,7 @@ private[spark] object Utils extends Logging {
14371437
val serviceString = if (serviceName.isEmpty) "" else s" '$serviceName'"
14381438
for (offset <- 0 to maxRetries) {
14391439
// Do not increment port if startPort is 0, which is treated as a special port
1440-
val tryPort = if (startPort == 0) startPort else (startPort + offset) % 65536
1440+
val tryPort = if (startPort == 0) startPort else (startPort + offset) % (65536 - 1024) + 1024
14411441
try {
14421442
val (service, port) = startService(tryPort)
14431443
logInfo(s"Successfully started service$serviceString on port $port.")

0 commit comments

Comments
 (0)