Jenkins Job Failing for urllib3:ValueError:超时值connect为< object object at 0x7efe5adb9aa0>,但必须为int、float或None

v440hwme  于 2023-05-06  发布在  Jenkins
关注(0)|答案(1)|浏览(1150)

截至2023年5月4日16:00,我开始看到我们的一个Jenkins作业失败,并出现以下错误:

Traceback (most recent call last):
   File "/home/jenkins/agent/workspace/my-jenkins-job/.tox/appdev-ci-staging/lib/python3.9/site-packages/jenkins/__init__.py", line 822, in get_info
     return json.loads(self.jenkins_open(
   File "/home/jenkins/agent/workspace/my-jenkins-job/.tox/appdev-ci-staging/lib/python3.9/site-packages/jenkins/__init__.py", line 560, in jenkins_open
     return self.jenkins_request(req, add_crumb, resolve_auth).text
   File "/home/jenkins/agent/workspace/my-jenkins-job/.tox/appdev-ci-staging/lib/python3.9/site-packages/jenkins/__init__.py", line 576, in jenkins_request
     self.maybe_add_crumb(req)
   File "/home/jenkins/agent/workspace/my-jenkins-job/.tox/appdev-ci-staging/lib/python3.9/site-packages/jenkins/__init__.py", line 373, in maybe_add_crumb
     response = self.jenkins_open(requests.Request(
   File "/home/jenkins/agent/workspace/my-jenkins-job/.tox/appdev-ci-staging/lib/python3.9/site-packages/jenkins/__init__.py", line 560, in jenkins_open
     return self.jenkins_request(req, add_crumb, resolve_auth).text
   File "/home/jenkins/agent/workspace/my-jenkins-job/.tox/appdev-ci-staging/lib/python3.9/site-packages/jenkins/__init__.py", line 579, in jenkins_request
     self._request(req))
   File "/home/jenkins/agent/workspace/my-jenkins-job/.tox/appdev-ci-staging/lib/python3.9/site-packages/jenkins/__init__.py", line 553, in _request
     return self._session.send(r, **_settings)
   File "/home/jenkins/agent/workspace/my-jenkins-job/.tox/appdev-ci-staging/lib/python3.9/site-packages/requests/sessions.py", line 701, in send
     r = adapter.send(request, **kwargs)
   File "/home/jenkins/agent/workspace/my-jenkins-job/.tox/appdev-ci-staging/lib/python3.9/site-packages/requests/adapters.py", line 483, in send
     timeout = TimeoutSauce(connect=timeout, read=timeout)
   File "/home/jenkins/agent/workspace/my-jenkins-job/.tox/appdev-ci-staging/lib/python3.9/site-packages/urllib3/util/timeout.py", line 119, in __init__
     self._connect = self._validate_timeout(connect, "connect")
   File "/home/jenkins/agent/workspace/my-jenkins-job/.tox/appdev-ci-staging/lib/python3.9/site-packages/urllib3/util/timeout.py", line 156, in _validate_timeout
     raise ValueError(
 ValueError: Timeout value connect was <object object at 0x7efe5adb9aa0>, but it must be an int, float or None.

由于在我的配置中我这边没有任何变化,这看起来像是一个上游问题。
我在工作中使用requests Python库,requests使用urllib3
我们该怎么解决这个问题?

o7jaxewo

o7jaxewo1#

urllib3的新版本2.0.2于2023年5月4日发布,可以在这里看到:urllib 3 2.0.2 -发布历史
当我的作业在虚拟Python环境中使用pip在作业开始时安装Python库时,它开始安装最新版本的urllib3,这有一些问题。这似乎是一个上游问题。

我通过将urllib3版本固定到requirements.txt文件中的>=1.26.15,<2来修复它。

相关问题