Skip to content

Commit da05d64

Browse files
committed
inclusive-exclusive issue fix
1 parent cd1a88d commit da05d64

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1670,10 +1670,10 @@ private[spark] object Utils extends Logging {
16701670
for (offset <- 0 to maxRetries) {
16711671
// Do not increment port if port is 0, which is treated as a special port
16721672
val tryPort = if (port == 0) {
1673-
(startPort + Math.random() * (endPort - startPort)).toInt
1673+
port
16741674
} else {
16751675
// If the new port wraps around, ensure it is in range(startPort, endPort)
1676-
((port + offset - startPort) % (endPort - startPort)) + startPort
1676+
((port + offset) % (endPort - startPort + 1)) + startPort
16771677
}
16781678
try {
16791679
val (service, port) = startService(tryPort)

0 commit comments

Comments
 (0)