Skip to content
Snippets Groups Projects
Commit 6390aae4 authored by scwf's avatar scwf Committed by Andrew Or
Browse files

[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 <wangfei1@huawei.com>

Closes #2610 from scwf/1-1024 and squashes the following commits:

cb8cc76 [scwf] do not use port 1 - 1024
parent dcb2f73f
No related branches found
No related tags found
No related merge requests found
......@@ -1437,7 +1437,7 @@ private[spark] object Utils extends Logging {
val serviceString = if (serviceName.isEmpty) "" else s" '$serviceName'"
for (offset <- 0 to maxRetries) {
// Do not increment port if startPort is 0, which is treated as a special port
val tryPort = if (startPort == 0) startPort else (startPort + offset) % 65536
val tryPort = if (startPort == 0) startPort else (startPort + offset) % (65536 - 1024) + 1024
try {
val (service, port) = startService(tryPort)
logInfo(s"Successfully started service$serviceString on port $port.")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment