We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cd1a88d commit da05d64Copy full SHA for da05d64
core/src/main/scala/org/apache/spark/util/Utils.scala
@@ -1670,10 +1670,10 @@ private[spark] object Utils extends Logging {
1670
for (offset <- 0 to maxRetries) {
1671
// Do not increment port if port is 0, which is treated as a special port
1672
val tryPort = if (port == 0) {
1673
- (startPort + Math.random() * (endPort - startPort)).toInt
+ port
1674
} else {
1675
// If the new port wraps around, ensure it is in range(startPort, endPort)
1676
- ((port + offset - startPort) % (endPort - startPort)) + startPort
+ ((port + offset) % (endPort - startPort + 1)) + startPort
1677
}
1678
try {
1679
val (service, port) = startService(tryPort)
0 commit comments