Skip to content

Commit

Permalink
[SPARK-3755][Core] Do not bind port 1 - 1024 to server in spark
Browse files Browse the repository at this point in the history
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 apache#2610 from scwf/1-1024 and squashes the following commits:

cb8cc76 [scwf] do not use port 1 - 1024
  • Loading branch information
scwf authored and andrewor14 committed Oct 1, 2014
1 parent dcb2f73 commit 6390aae
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion core/src/main/scala/org/apache/spark/util/Utils.scala
Original file line number Diff line number Diff line change
Expand Up @@ -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.")
Expand Down

0 comments on commit 6390aae

Please sign in to comment.