aboutsummaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorscwf <wangfei1@huawei.com>2014-10-01 11:30:29 -0700
committerAndrew Or <andrewor14@gmail.com>2014-10-01 11:30:39 -0700
commitc8c3b49f265e7a6246ce7e80e0101be6e735522f (patch)
tree9542a6456dc1840262cdd19814464b31bf131037 /core
parenta7d2df42bb98fab045be653283b1eae731aeccea (diff)
downloadspark-c8c3b49f265e7a6246ce7e80e0101be6e735522f.tar.gz
spark-c8c3b49f265e7a6246ce7e80e0101be6e735522f.tar.bz2
spark-c8c3b49f265e7a6246ce7e80e0101be6e735522f.zip
[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 (cherry picked from commit 6390aae4eacbabfb1c53fb828b824f6a6518beff) Signed-off-by: Andrew Or <andrewor14@gmail.com>
Diffstat (limited to 'core')
-rw-r--r--core/src/main/scala/org/apache/spark/util/Utils.scala2
1 files changed, 1 insertions, 1 deletions
diff --git a/core/src/main/scala/org/apache/spark/util/Utils.scala b/core/src/main/scala/org/apache/spark/util/Utils.scala
index fb477f89e9..700083e8ea 100644
--- a/core/src/main/scala/org/apache/spark/util/Utils.scala
+++ b/core/src/main/scala/org/apache/spark/util/Utils.scala
@@ -1457,7 +1457,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.")