Skip to content

Commit 5f5427f

Browse files
committedFeb 19, 2016
protocols/pipe_ipc: work around race condition with loop.start_serving_pipe/close on Windows
1 parent 28c4d8c commit 5f5427f

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed
 

Diff for: ‎artiq/protocols/pipe_ipc.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,16 @@ def factory():
141141
asyncio.ensure_future(self._autoclose())
142142

143143
def _child_connected(self, reader, writer):
144-
self.server[0].close()
144+
# HACK: We should shut down the pipe server here.
145+
# However, self.server[0].close() is racy, and will cause an
146+
# invalid handle error if loop.start_serving_pipe has not finished
147+
# its work in the background.
148+
# The bug manifests itself here frequently as the event loop is
149+
# reopening the server as soon as a new client connects.
150+
# There is still a race condition in the AsyncioParentComm
151+
# creation/destruction, but it is unlikely to cause problems
152+
# in most practical cases.
153+
assert self.server is not None
145154
self.server = None
146155
self.reader = reader
147156
self.writer = writer

0 commit comments

Comments
 (0)
Please sign in to comment.