Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
34 changes: 24 additions & 10 deletions docker/transport/npipesocket.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
import win32file
import win32pipe

cERROR_PIPE_BUSY = 0xe7
cSECURITY_SQOS_PRESENT = 0x100000
cSECURITY_ANONYMOUS = 0
cPIPE_READMODE_MESSAGE = 2

RETRY_WAIT_TIMEOUT = 10000


def check_closed(f):
Expand Down Expand Up @@ -45,15 +47,27 @@ def close(self):
@check_closed
def connect(self, address):
win32pipe.WaitNamedPipe(address, self._timeout)
handle = win32file.CreateFile(
address,
win32file.GENERIC_READ | win32file.GENERIC_WRITE,
0,
None,
win32file.OPEN_EXISTING,
cSECURITY_ANONYMOUS | cSECURITY_SQOS_PRESENT,
0
)
try:
handle = win32file.CreateFile(
address,
win32file.GENERIC_READ | win32file.GENERIC_WRITE,
0,
None,
win32file.OPEN_EXISTING,
cSECURITY_ANONYMOUS | cSECURITY_SQOS_PRESENT,
0
)
except win32pipe.error as e:
# See Remarks:
# https://msdn.microsoft.com/en-us/library/aa365800.aspx
if e.winerror == cERROR_PIPE_BUSY:
# Another program or thread has grabbed our pipe instance
# before we got to it. Wait for availability and attempt to
# connect again.
win32pipe.WaitNamedPipe(address, RETRY_WAIT_TIMEOUT)
return self.connect(address)
raise e

self.flags = win32pipe.GetNamedPipeInfo(handle)[0]

self._handle = handle
Expand Down
2 changes: 1 addition & 1 deletion docker/version.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
version = "1.10.4"
version = "1.10.5"
version_info = tuple([int(d) for d in version.split("-")[0].split(".")])
11 changes: 11 additions & 0 deletions docs/change_log.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,17 @@
Change Log
==========

1.10.5
------

[List of PRs / issues for this release](https://github.com/docker/docker-py/milestone/24?closed=1)

### Bugfixes

* Fixed an issue where concurrent attempts to access to a named pipe by the
client would sometimes cause recoverable exceptions to be raised.


1.10.4
------

Expand Down