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

Cannot pass timeout to a show() or any other function, makes aiodocker hang long time #859

Open
ualex73 opened this issue May 26, 2024 · 2 comments

Comments

@ualex73
Copy link
Contributor

ualex73 commented May 26, 2024

Long story short

  • Expected behaviour: Timeout passable as argument
  • Actual behaviour: Timeout does not seem to be used in "docker.py" in _do_query function

How to reproduce

Setup connection, block connection with e.g. "iptables".
Call the "show" of a container:
outp = await self._container.show(timeout=3)

It does not timeout after 3 seconds, it hangs for many minutes. Also, debugging in "_do_query", I do not see the value passed to the function from the show.

Your environment

Debian 12, standard Docker

@achimnol
Copy link
Member

achimnol commented Jun 22, 2024

In general, the recommended way to enforce timeout is to use asyncio.timeout() added in Python 3.11, instead of manually specifying the timeouts to all async APIs.

Timeouts in arbitrary async codes appear as cancellation from outside from the perspective of target codes.

See: https://docs.python.org/3/library/asyncio-task.html#asyncio.Timeout

@achimnol
Copy link
Member

achimnol commented Jun 22, 2024

However, there are more subtle cases that you may want to control detailed connection timeout behavior like when accessing remote Docker instances via TCP, for example.

I think it would be a nice idea to expose aiohttp.ClientTimeout interface for aiodocker users to control more details.

Currently you can customize some parts of the timeout by passing your own created aiohttp connectors.

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

No branches or pull requests

2 participants