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.

Timeout incompatibility

See original GitHub issue

Hi, i’m on a Debian Sid with docker-py 0.5.3-1 and i have a problem with timeout parameter :

import docker

c = docker.Client(base_url='unix://var/run/docker.sock', version='1.15', timeout=2.0)
l = c.containers(all=True)      

trace :

Traceback (most recent call last):                                                                                 
  File "./check.py", line 10, in <module>                                                                          
    l = c.containers(all=True)                                                                                     
  File "/usr/lib/python2.7/dist-packages/docker/client.py", line 493, in containers                                
    res = self._result(self._get(u, params=params), True)                                                          
  File "/usr/lib/python2.7/dist-packages/docker/client.py", line 76, in _get                                       
    return self.get(url, **self._set_request_timeout(kwargs))                                                      
  File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 469, in get                                   
    return self.request('GET', url, **kwargs)                                                                      
  File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 457, in request                               
    resp = self.send(prep, **send_kwargs)                                                                          
  File "/usr/lib/python2.7/dist-packages/requests/sessions.py", line 569, in send                                  
    r = adapter.send(request, **kwargs)                                                                            
  File "/usr/lib/python2.7/dist-packages/requests/adapters.py", line 362, in send                                  
    timeout=timeout                                                                                                
  File "/usr/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py", line 522, in urlopen        
    body=body, headers=headers)                                                                                    
  File "/usr/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py", line 305, in _make_request  
    timeout_obj = self._get_timeout(timeout)                                                                       
  File "/usr/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py", line 285, in _get_timeout   
    return Timeout.from_float(timeout)                                                                             
  File "/usr/lib/python2.7/dist-packages/requests/packages/urllib3/util/timeout.py", line 152, in from_float       
    return Timeout(read=timeout, connect=timeout)                                                                  
  File "/usr/lib/python2.7/dist-packages/requests/packages/urllib3/util/timeout.py", line 95, in __init__          
    self._connect = self._validate_timeout(connect, 'connect')                                                     
  File "/usr/lib/python2.7/dist-packages/requests/packages/urllib3/util/timeout.py", line 125, in _validate_timeout
    "int or float." % (name, value))                                                                               
ValueError: Timeout value connect was Timeout(connect=2.0, read=2.0, total=None), but it must be an int or float.  

To fix the problem i have to modify directly /usr/lib/python2.7/dist-packages/requests/packages/urllib3/connectionpool.py

def _get_timeout(self, timeout):                                            
    """ Helper that always returns a :class:`urllib3.util.Timeout` """      
    if timeout is _Default:                                                           
        return self.timeout.clone()                                         

    if isinstance(timeout, Timeout): <========================== Timeout is not a urllib3 timeout
        return timeout.clone()                                              
    else:                                                                   
        # User passed us an int/float. This is for backwards compatibility, 
        # can be removed later                                                                                                 
        return Timeout.from_float(timeout._connect ) <======================= manually entered _connect

I thnk it’s a docker-py problem…

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:18 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
shin-commented, Apr 9, 2015

No yeah, actually, try downgrading your version of requests (pip install -U requests==2.5.3) and see if it helps.

1reaction
shin-commented, Apr 9, 2015

What happens if you pip install -U requests==2.5.3? Same issue?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Timeout Mismatch - Linux Raid Wiki
The proper sequence of events when something goes wrong is that the drive can't read the data, it "tries harder" for a few...
Read more >
Python-Requests timeout incompatibility - Stack Overflow
I've read in similar questions that it could be an issue with older distributions of python or requests, but I have up to...
Read more >
Troubleshoot your Application Load Balancers
Check whether the client timeout period is greater than the idle timeout period for the load balancer. Ensure that your target provides a...
Read more >
User is currently connected from another machine or ...
User is currently connected from another machine or incompatible session. Hi, we using BMC Remedy 9.1.04 version.
Read more >
Infinite transaction timeout (0) incompatible with set-tx-query ...
Infinite transaction timeout (0) incompatible with set-tx-query-timeout in JBoss EAP 6.4. Solution Verified - Updated January 15 2019 at ...
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