question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

getting timeout after streaming logs for some time

See original GitHub issue

This is very likely an engine issue, first I would like to open here.

It looks like there is a change in behavior. When streaming logs with 1.10 I get timeout:

Traceback (most recent call last):
  File "/usr/lib64/python3.5/threading.py", line 914, in _bootstrap_inner
    self.run()
  File "/usr/lib64/python3.5/threading.py", line 862, in run
    self._target(*self._args, **self._kwargs)
  File "/home/tt/g/sen/sen/tui/widgets/list/common.py", line 43, in fetch_logs
    for line in generator:
  File "/home/tt/.local/lib/python3.5/site-packages/docker/client.py", line 279, in _stream_raw_result
    for out in response.iter_content(chunk_size=1, decode_unicode=True):
  File "/usr/lib/python3.5/site-packages/requests/utils.py", line 363, in stream_decode_response_unicode
    for chunk in iterator:
  File "/usr/lib/python3.5/site-packages/requests/models.py", line 667, in generate
    raise ConnectionError(e)
requests.exceptions.ConnectionError: UnixHTTPConnectionPool(host='localhost', port=None): Read timed out.

generator is client.logs(c, stream=True)

This repro should be sufficient: https://github.com/docker/docker-py/issues/919#issuecomment-181795059

I know this also happens when using compose.

Issue Analytics

  • State:closed
  • Created 8 years ago
  • Reactions:4
  • Comments:9 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
zultroncommented, Oct 23, 2019

On a detached container, for l in container.logs(stream=True, follow=True): print(l) times out after a while with the following traceback:

  File "/usr/local/lib/python2.7/dist-packages/docker/types/daemon.py", line 32, in __next__
    return next(self._stream)
  File "/usr/local/lib/python2.7/dist-packages/docker/api/client.py", line 396, in _stream_raw_result
    for out in response.iter_content(chunk_size, decode):
  File "/usr/local/lib/python2.7/dist-packages/requests/utils.py", line 500, in stream_decode_response_unicode
    for item in iterator:
  File "/usr/local/lib/python2.7/dist-packages/requests/models.py", line 757, in generate
    raise ConnectionError(e)
requests.exceptions.ConnectionError: UnixHTTPConnectionPool(host='localhost', port=None): Read timed out.

This happens when the container has no console output for long enough to exceed the timeout. A couple of workarounds helped:

  • Disable the timeout with client = docker.from_env(timeout=None) (None means no timeout to urllib3)
  • Set up a ‘heartbeat’ to periodically print to the console

This sounds like the issue @TomasTomecek. It also makes sense that @jasonamyers and @akki might hit this with other parts of the API that can possibly wait a long time for the server to respond.

While I’m not familiar with the code, ideally, these methods would set an infinite timeout, while other methods would set a reasonable default timeout.

0reactions
zultroncommented, Oct 23, 2019

Indeed you did; I missed the pingback from #1959.

That patch works for me in place of the workarounds in my previous comment.

+1

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix the ERR_CONNECTION_TIMED_OUT Error - Kinsta
All you have to do is figure out which one was at fault. Return to the wp-content directory, and rename your original plugins...
Read more >
How to Get to the Bottom of Network Timeout Issues
Based on the basic idea, first check the ECS instance and link for packet loss from the monitoring. The result shows that no...
Read more >
What Does a Server Connection Timeout Mean?
A server connection timeout means that a server is taking too long to reply to a data request made from another device. Timeouts...
Read more >
Common Timeouts effecting Web Services, HTTP and SOAP ...
The default value is 5 seconds. Increase the value to 30 seconds or greater. Set the value using the administrative console.
Read more >
Debugging AWS Lambda Timeouts - Lumigo
Some time ago, an ex-colleague of mine at DAZN received an alert ... Task timed out after against a Lambda function's log group...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found