Skip to content

Commit a28f495

Browse files
authored
Merge pull request #25126 from JuliaLang/amitm/listenport
Distributed: worker to supply a port_hint in the known range
2 parents d8929e9 + 2ec9145 commit a28f495

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

stdlib/Distributed/src/cluster.jl

+2-1
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,8 @@ function start_worker(out::IO, cookie::AbstractString=readline(STDIN))
194194
init_worker(cookie)
195195
interface = IPv4(LPROC.bind_addr)
196196
if LPROC.bind_port == 0
197-
(port, sock) = listenany(interface, UInt16(0))
197+
port_hint = 9000 + (getpid() % 1000)
198+
(port, sock) = listenany(interface, UInt16(port_hint))
198199
LPROC.bind_port = port
199200
else
200201
sock = listen(interface, LPROC.bind_port)

0 commit comments

Comments
 (0)