python-jenkins-developers team mailing list archive
-
python-jenkins-developers team
-
Mailing list archive
-
Message #00521
[Bug 1775047] [NEW] build_job() is failing with "... empty response" exception when Jenkins is behind haproxy where disabled keep_alive
Public bug reported:
Jenkins supports keep_alive http option, and when
JenkinsClient:build_job() is called, normally the response contains the
'content-length' header, for example:
ipdb> response.status_code
201
ipdb> response.headers
{'Date': 'Mon, 04 Jun 2018 11:52:00 GMT', 'Content-Length': '0', 'Location': 'http://10.70.0.15:8081/queue/item/11/', 'X-Content-Type-Options': 'nosniff', 'Server': 'Jetty(9.4.z-SNAPSHOT)'}
But if Jenkins master is behind HAProxy with enabled 'option httpclose',
which disables keep_alive, the response doesn't contain 'content-length'
header:
ipdb> response.status_code
201
ipdb> response.headers
{'Date': 'Mon, 04 Jun 2018 11:55:36 GMT', 'Connection': 'close', 'Location': 'http://10.60.0.90:8081/queue/item/16/', 'X-Content-Type-Options': 'nosniff', 'Server': 'Jetty(9.4.z-SNAPSHOT)'}
Other fields that are checked in JenkisClient:_response_handler() are empty in both cases:
ipdb> response.content
''
ipdb> response.text
u''
As the result: JenkinsClient raises an exception like:
File ".../local/lib/python2.7/site-packages/jenkins/__init__.py", line 1280, in build_job
'POST', self.build_job_url(name, parameters, token)))
File ".../lib/python2.7/site-packages/jenkins/__init__.py", line 565, in jenkins_request
self._request(req))
File ".../lib/python2.7/site-packages/jenkins/__init__.py", line 523, in _response_handler
"empty response" % self.server)
jenkins.EmptyResponseException: Error communicating with server[http://10.60.0.90:8081/]: empty response
However, the response is valid because the meaningful part of the
response is the header 'Location'.
** Affects: python-jenkins
Importance: Undecided
Assignee: Dennis Dmitriev (ddmitriev)
Status: In Progress
--
You received this bug notification because you are a member of Python
Jenkins Developers, which is subscribed to Python Jenkins.
https://bugs.launchpad.net/bugs/1775047
Title:
build_job() is failing with "... empty response" exception when
Jenkins is behind haproxy where disabled keep_alive
Status in Python Jenkins:
In Progress
Bug description:
Jenkins supports keep_alive http option, and when
JenkinsClient:build_job() is called, normally the response contains
the 'content-length' header, for example:
ipdb> response.status_code
201
ipdb> response.headers
{'Date': 'Mon, 04 Jun 2018 11:52:00 GMT', 'Content-Length': '0', 'Location': 'http://10.70.0.15:8081/queue/item/11/', 'X-Content-Type-Options': 'nosniff', 'Server': 'Jetty(9.4.z-SNAPSHOT)'}
But if Jenkins master is behind HAProxy with enabled 'option
httpclose', which disables keep_alive, the response doesn't contain
'content-length' header:
ipdb> response.status_code
201
ipdb> response.headers
{'Date': 'Mon, 04 Jun 2018 11:55:36 GMT', 'Connection': 'close', 'Location': 'http://10.60.0.90:8081/queue/item/16/', 'X-Content-Type-Options': 'nosniff', 'Server': 'Jetty(9.4.z-SNAPSHOT)'}
Other fields that are checked in JenkisClient:_response_handler() are empty in both cases:
ipdb> response.content
''
ipdb> response.text
u''
As the result: JenkinsClient raises an exception like:
File ".../local/lib/python2.7/site-packages/jenkins/__init__.py", line 1280, in build_job
'POST', self.build_job_url(name, parameters, token)))
File ".../lib/python2.7/site-packages/jenkins/__init__.py", line 565, in jenkins_request
self._request(req))
File ".../lib/python2.7/site-packages/jenkins/__init__.py", line 523, in _response_handler
"empty response" % self.server)
jenkins.EmptyResponseException: Error communicating with server[http://10.60.0.90:8081/]: empty response
However, the response is valid because the meaningful part of the
response is the header 'Location'.
To manage notifications about this bug go to:
https://bugs.launchpad.net/python-jenkins/+bug/1775047/+subscriptions
Follow ups