-
-
Notifications
You must be signed in to change notification settings - Fork 34.5k
gh-137335: Fix unlikely name conflicts for named pipes in multiprocessing and asyncio on Windows #137389
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gh-137335: Fix unlikely name conflicts for named pipes in multiprocessing and asyncio on Windows #137389
Changes from 1 commit
2a0a5e9
5b91a56
ed050a0
7363c99
5243b9e
81cb66e
5207bf6
cae80b9
de04089
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- Loading branch information
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -23,6 +23,7 @@ | |
| PIPE = subprocess.PIPE | ||
| STDOUT = subprocess.STDOUT | ||
| _mmap_counter = itertools.count() | ||
| _MAX_PIPE_ATTEMPTS = 100 | ||
|
|
||
|
|
||
| # Replacement for os.pipe() using handles instead of fds | ||
|
|
@@ -51,7 +52,7 @@ def pipe(*, duplex=False, overlapped=(True, True), bufsize=BUFSIZE): | |
|
|
||
| h1 = h2 = None | ||
| try: | ||
| while True: | ||
| for attempts in itertools.count(): | ||
| address = r'\\.\pipe\python-pipe-{:d}-{:d}-{}'.format( | ||
| os.getpid(), next(_mmap_counter), os.urandom(8).hex()) | ||
| try: | ||
|
|
@@ -60,6 +61,8 @@ def pipe(*, duplex=False, overlapped=(True, True), bufsize=BUFSIZE): | |
| 1, obsize, ibsize, _winapi.NMPWAIT_WAIT_FOREVER, _winapi.NULL) | ||
| break | ||
| except OSError as e: | ||
| if attempts >= _MAX_PIPE_ATTEMPTS: | ||
| raise | ||
| if e.winerror not in (_winapi.ERROR_PIPE_BUSY, | ||
| _winapi.ERROR_ACCESS_DENIED): | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. an infinite loop retrying on this error could potentially hide an error if the system simply doesn't allow this process to create a pipe with the given address? (here and below)
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I do not know if this is even possible ( |
||
| raise | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.