setblocking(False) fails on npipesocket object
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 7.2k
- Forks
- 1.7k
- Avg merge
- 13d 8h
- Merged PRs (30d)
- 2
Description
I'm currently working with a socket produced by the container exec_run() function. I am trying to set the socket to be non-blocking (i.e. instant timeout if no data to receive), but running into an error when executing socket.setblocking(False).
This is an area of Python I haven't really explored before so forgive any missing detail - let me know if any more info would be helpful.
Stacktrace
Traceback (most recent call last):
File "d:\Repositories\DockerProj\test.py", line 9, in __init__
self.socket.setblocking(False)
File "D:\Repositories\DockerProj\.venv\lib\site-packages\docker\transport\npipesocket.py", line 167, in setblocking
return self.settimeout(0)
File "D:\Repositories\DockerProj\.venv\lib\site-packages\docker\transport\npipesocket.py", line 177, in settimeout
self._timeout = win32pipe.NMPWAIT_NO_WAIT
AttributeError: module 'win32pipe' has no attribute 'NMPWAIT_NO_WAIT'
System information
OS: Windows 10 Build 19041
Docker-py version: 4.3.1
Python version: 3.8.5
Docker information
Client: Docker Engine - Community
Cloud integration: 1.0.2
Version: 19.03.13
API version: 1.40
Go version: go1.13.15
Git commit: 4484c46d9d
Built: Wed Sep 16 17:00:27 2020
OS/Arch: windows/amd64
Experimental: false
Server: Docker Engine - Community
Engine:
Version: 19.03.13
API version: 1.40 (minimum version 1.12)
Go version: go1.13.15
Git commit: 4484c46d9d
Built: Wed Sep 16 17:07:04 2020
OS/Arch: linux/amd64
Experimental: false
containerd:
Version: v1.3.7
GitCommit: 8fba4e9a7d01810a393d5d25a3621dc101981175
runc:
Version: 1.0.0-rc10
GitCommit: dc9208a3303feef5b3839f4323d9beb36df0a9dd
docker-init:
Version: 0.18.0
GitCommit: fec3683
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in docker/transport/npipesocket.py at setblocking and settimeout, where the stack trace shows the failure. Reproduce the call with a socket returned by exec_run() on Windows, then verify that setting non-blocking mode no longer raises AttributeError and produces the requested immediate timeout behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, python
- Domain
- backend, networking
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 42/100