Skip to content

Commit 34de53f

Browse files
committed
Use thread ID for multiprocessing manager socket path
1 parent b1e1896 commit 34de53f

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

graalpython/lib-python/3/multiprocessing/connection.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020

2121
import _multiprocessing
2222

23+
import threading
2324
from . import util
2425

2526
from . import AuthenticationError, BufferTooShort
@@ -77,11 +78,13 @@ def arbitrary_address(family):
7778
# size. When coding portable applications, some implementations have
7879
# sun_path as short as 92 bytes in the sockaddr_un struct.
7980
if util.abstract_sockets_supported:
80-
return f"\0listener-{os.getpid()}-{next(_mmap_counter)}"
81+
# GraalVM change: add thread ID, we may be in the same process
82+
return f"\0listener-{os.getpid()}-{threading.current_thread().native_id}-{next(_mmap_counter)}"
8183
return tempfile.mktemp(prefix='listener-', dir=util.get_temp_dir())
8284
elif family == 'AF_PIPE':
83-
return tempfile.mktemp(prefix=r'\\.\pipe\pyc-%d-%d-' %
84-
(os.getpid(), next(_mmap_counter)), dir="")
85+
# GraalVM change: add thread ID, we may be in the same process
86+
return tempfile.mktemp(prefix=r'\\.\pipe\pyc-%d-%d-%d-' %
87+
(os.getpid(), threading.current_thread().native_id, next(_mmap_counter)), dir="")
8588
else:
8689
raise ValueError('unrecognized family')
8790

0 commit comments

Comments
 (0)