Urllib3: ValueError: Timeout value connect was Timeout

Created on 13 May 2020  路  7Comments  路  Source: urllib3/urllib3

We have been using docker-compose for running multiple containers. All of a sudden started receiving the below error. There were no updates performed on the server box:

[app]# docker-compose ps
Traceback (most recent call last):
  File "/bin/docker-compose", line 11, in <module>
    sys.exit(main())
  File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 68, in main
    command()
  File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 118, in perf                                                                             orm_command
    handler(command, command_options)
  File "/usr/lib/python2.7/site-packages/compose/cli/main.py", line 601, in ps
    self.project.containers(service_names=options['SERVICE'], stopped=True) +
  File "/usr/lib/python2.7/site-packages/compose/project.py", line 498, in conta                                                                             iners
    containers = self._labeled_containers(stopped, one_off)
  File "/usr/lib/python2.7/site-packages/compose/project.py", line 489, in _labe                                                                             led_containers
    filters={'label': self.labels(one_off=one_off)})])
  File "/usr/lib/python2.7/site-packages/docker/api/container.py", line 189, in                                                                              containers
    res = self._result(self._get(u, params=params), True)
  File "/usr/lib/python2.7/site-packages/docker/utils/decorators.py", line 47, i                                                                             n inner
    return f(self, *args, **kwargs)
  File "/usr/lib/python2.7/site-packages/docker/api/client.py", line 183, in _ge                                                                             t
    return self.get(url, **self._set_request_timeout(kwargs))
  File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 498, in get
    return self.request('GET', url, **kwargs)
  File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 486, in req                                                                             uest
    resp = self.send(prep, **send_kwargs)
  File "/usr/lib/python2.7/site-packages/requests/sessions.py", line 598, in sen                                                                             d
    r = adapter.send(request, **kwargs)
  File "/usr/lib/python2.7/site-packages/requests/adapters.py", line 370, in sen                                                                             d
    timeout=timeout
  File "/usr/lib/python2.7/site-packages/requests/packages/urllib3/connectionpoo                                                                             l.py", line 582, in urlopen
    timeout_obj = self._get_timeout(timeout)
  File "/usr/lib/python2.7/site-packages/requests/packages/urllib3/connectionpoo                                                                             l.py", line 309, in _get_timeout
    return Timeout.from_float(timeout)
  File "/usr/lib/python2.7/site-packages/requests/packages/urllib3/util/timeout.                                                                             py", line 154, in from_float
    return Timeout(read=timeout, connect=timeout)
  File "/usr/lib/python2.7/site-packages/requests/packages/urllib3/util/timeout.                                                                             py", line 97, in __init__
    self._connect = self._validate_timeout(connect, 'connect')
  File "/usr/lib/python2.7/site-packages/requests/packages/urllib3/util/timeout.                                                                             py", line 127, in _validate_timeout
    "int or float." % (name, value))
ValueError: Timeout value connect was Timeout(connect=60, read=60, total=None),                                                                              but it must be an int or float.

Here's my pip list

pip list
DEPRECATION: The default format will switch to columns in the future. You can use --format=(legacy|columns) (or define a format=(legacy|columns) in your pip.conf under the [list] section) to disable this warning.
awscli (1.11.92)
backports.ssl-match-hostname (3.5.0.1)
botocore (1.5.55)
cached-property (1.3.0)
cffi (1.6.0)
chardet (2.2.1)
colorama (0.3.7)
configobj (4.7.2)
configshell-fb (1.1.25)
cryptography (1.7.2)
custodia (0.3.1)
decorator (3.4.0)
dnspython (1.12.0)
docker (2.3.0)
docker-compose (1.13.0)
docker-pycreds (0.2.1)
dockerpty (0.4.1)
docopt (0.6.2)
docutils (0.13.1)
enum34 (1.0.4)
ethtool (0.8)
functools32 (3.2.3-2)
futures (3.1.1)
gssapi (1.2.0)
idna (2.4)
iniparse (0.4)
iotop (0.6)
ipaclient (4.6.5)
ipaddress (1.0.16)
ipalib (4.6.5)
ipaplatform (4.6.5)
ipapython (4.6.5)
IPy (0.75)
javapackages (1.0.0)
jmespath (0.9.2)
jsonschema (2.6.0)
jwcrypto (0.4.2)
kitchen (1.1.1)
kmod (0.1)
langtable (0.0.31)
lxml (3.2.1)
Magic-file-extensions (0.2)
MySQL-python (1.2.5)
netaddr (0.7.5)
netifaces (0.10.4)
nose (1.3.7)
numpy (1.7.1)
pcp (4.1)
perf (0.1)
pip (9.0.1)
ply (3.4)
policycoreutils-default-encoding (0.1)
psycopg2 (2.5.1)
pyasn1 (0.1.9)
pyasn1-modules (0.0.8)
pycparser (2.14)
pycurl (7.19.0)
pygobject (3.22.0)
pygpgme (0.3)
pyinotify (0.9.4)
pyliblzma (0.5.3)
pyOpenSSL (0.13.1)
pyparsing (1.5.6)
python-augeas (0.5.0)
python-dateutil (2.6.0)
python-dmidecode (3.10.13)
python-ldap (2.4.15)
python-linux-procfs (0.4.9)
python-nss (0.16.0)
python-yubico (1.2.3)
pyudev (0.15)
pyusb (1.0.0b1)
pyxattr (0.5.1)
PyYAML (3.12)
qrcode (5.0.1)
requests (2.11.1)
rsa (3.4.2)
rtslib-fb (2.1.69)
s3transfer (0.1.10)
schedutils (0.4)
seobject (0.1)
sepolicy (1.1)
setuptools (0.9.8)
six (1.9.0)
slip (0.4.0)
slip.dbus (0.4.0)
SSSDConfig (1.16.4)
subscription-manager (1.24.13)
syspurpose (1.24.13)
targetcli-fb (2.1.fb49)
texttable (0.8.8)
urlgrabber (3.10)
urllib3 (1.10.2)
urwid (1.1.1)
virtualenv (15.1.0)
websocket-client (0.40.0)
wheel (0.29.0)
yum-langpacks (0.4.2)
yum-metadata-parser (1.1.4)
You are using pip version 9.0.1, however version 20.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.

Kindly request help on fixing this

All 7 comments

urllib3 1.10.2 was released in early 2015, can you try upgrading to urllib3 1.25.9 or is there a reason you can't upgrade?

@sethmlarson Thank you for the quick response. We haven't planned upgrading docker-compose. Can we try reinstalling urllib3 without specifying any version so that it picks up the stable one ? Will that help ?

If possible that is what I would try. You can also try upgrading requests package as well. Because we know the most recent version does not have this issue otherwise we'd be getting it a lot more frequently. :)

Sure, will try that. Thanks much @sethmlarson , Appreciate your quick response :)

I'm going to close this as 'not an issue with urllib3' but would still like to hear the resolution you find. Thanks!

Thank much @sethmlarson , reinstalling requests worked :+1:

@sithara Great!

By the way, can you please consider installing docker-compose using Python 3? Python 2.7 has reached its end of life, the next docker-compose version won't support it, and having many urllib3 users on Python 2.7 means more work for us. Thanks!

Was this page helpful?
0 / 5 - 0 ratings