Closed
Description
Bug report
On Windows, several calls to os.stat()
on the named pipe used by asyncio.ProactorEventLoop.start_serving_pipe()
will result in an OSError
. At this time, the first call to os.stat()
will cause a BrokenPipeError
on the server side.
Steps to reproduce
Run the pipe server in Command Prompt:
>type pipe_server.py
import asyncio
async def start_server():
pipe = r'\\.\pipe\_test_pipe_server'
loop = asyncio.get_event_loop()
await loop.start_serving_pipe(asyncio.Protocol, pipe)
await asyncio.sleep(3600)
asyncio.run(start_server())
>python pipe_server.py
Run the following script as client on another Command Prompt:
>type pipe_stat.py
import os
pipe = r'\\.\pipe\_test_pipe_server'
os.stat(pipe)
>python pipe_stat.py
Display the following messages on the server side:
Pipe accept failed
pipe: <PipeHandle handle=368>
Traceback (most recent call last):
File "d:\python_build\Python-3.9.13\lib\asyncio\windows_events.py", line 368, in loop_accept_pipe
f = self._proactor.accept_pipe(pipe)
File "d:\python_build\Python-3.9.13\lib\asyncio\windows_events.py", line 636, in accept_pipe
connected = ov.ConnectNamedPipe(pipe.fileno())
BrokenPipeError: [WinError 232] The pipe is being closed
On client side, run pipe_stat.py
repeat several times, then OSError
occured:
Traceback (most recent call last):
File "C:\Users\<user>\Desktop\pipe_stat.py", line 4, in <module>
os.stat(pipe)
OSError: [WinError 231] All pipe instances are busy: '\\\\.\\pipe\\_test_pipe_server'
This problem seems to stem from commit 9eb3d54 between 3.8.0b3 and 3.8.0b4.
Your environment
- CPython versions tested on: 3.8.0b3+(9eb3d54), 3.8.0, 3.9.13, 3.10.9, 3.11.1
- Operating system and architecture: Windows 10 x64
Linked PRs
Metadata
Metadata
Assignees
Projects
Status
Done