Skip to content
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

socket timeout when docker exec lasts too long #3124

Closed
loic-slamcore opened this issue May 10, 2023 · 2 comments
Closed

socket timeout when docker exec lasts too long #3124

loic-slamcore opened this issue May 10, 2023 · 2 comments

Comments

@loic-slamcore
Copy link

Since docker-py 6.1.0, using container.exec_run raises a socket.timeout exception if the command executed exceeds the timeout set on sockets when initialising the client.
This can be reproduced with the following code:

import docker
client = docker.from_env(timeout=2)
cnt = client.containers.run("ubuntu:22.04", tty=True, detach=True)
cnt.exec_run("sleep 20")

This was introduced by this PR because the previous call to select.select would only listen for reads, whereas the call to poll.register also listens to POLLOUT events.

I guess there's a case for raising timeout errors but ignoring them was previously working just fine so in my eyes, no exception should be raised especially as the polling can wait until the socket really is available for read instead.

This has been reproduced with the following setup:

pip freeze | grep docker && python --version && docker version
docker==6.1.1
Python 3.11.3
Client: Docker Engine - Community
 Version:           23.0.6
 API version:       1.42
 Go version:        go1.19.9
 Git commit:        ef23cbc
 Built:             Fri May  5 21:18:22 2023
 OS/Arch:           linux/amd64
 Context:           default

Server: Docker Engine - Community
 Engine:
  Version:          23.0.6
  API version:      1.42 (minimum version 1.12)
  Go version:       go1.19.9
  Git commit:       9dbdbd4
  Built:            Fri May  5 21:18:22 2023
  OS/Arch:          linux/amd64
  Experimental:     false
 containerd:
  Version:          1.6.21
  GitCommit:        3dce8eb055cbb6872793272b4f20ed16117344f8
 runc:
  Version:          1.1.7
  GitCommit:        v1.1.7-0-g860f061
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0
@loic-slamcore
Copy link
Author

I raised #3125 to resolve this issue.

tonybart1337 added a commit to supervisely/agent that referenced this issue May 11, 2023
@milas
Copy link
Contributor

milas commented May 12, 2023

Fixed in 6.1.2. Thanks for raising the issue and fix!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants