httplib.py crashed constructing an HTTPResponse for None socket

Bug #809145 reported by Bryce Harrington
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python2.6 (Ubuntu)
Invalid
Undecided
Unassigned

Bug Description

I've been getting these crashes sporadically with launchpadlib scripts. It happens very intermittently, perhaps once every 20-30 runs (about once every few days). Typical example:

  File "/srv/Source/Arsenal/arsenal/scripts/arsenal_lib.py", line 607, in bugtask_as_dict
    'date_last_message': bugtask.bug.date_last_message.ctime(),
  File "/usr/lib/python2.6/dist-packages/lazr/restfulclient/resource.py", line 643, in __getattr__
    return super(Entry, self).__getattr__(name)
  File "/usr/lib/python2.6/dist-packages/lazr/restfulclient/resource.py", line 305, in __getattr__
    return self.lp_get_parameter(attr)
  File "/usr/lib/python2.6/dist-packages/lazr/restfulclient/resource.py", line 196, in lp_get_parameter
    self._ensure_representation()
  File "/usr/lib/python2.6/dist-packages/lazr/restfulclient/resource.py", line 331, in _ensure_representation
    representation = self._root._browser.get(self._wadl_resource)
  File "/usr/lib/python2.6/dist-packages/lazr/restfulclient/_browser.py", line 287, in get
    response, content = self._request(url, extra_headers=headers)
  File "/usr/lib/python2.6/dist-packages/lazr/restfulclient/_browser.py", line 242, in _request
    str(url), method=method, body=data, headers=headers)
  File "/usr/lib/python2.6/dist-packages/lazr/restfulclient/_browser.py", line 211, in _request_and_retry
    url, method=method, body=body, headers=headers)
  File "/usr/lib/python2.6/dist-packages/httplib2/__init__.py", line 1099, in request
    (response, new_content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections
, cachekey)
  File "/usr/lib/python2.6/dist-packages/lazr/restfulclient/_browser.py", line 130, in _request
    redirections, cachekey)
  File "/usr/lib/python2.6/dist-packages/httplib2/__init__.py", line 901, in _request
    (response, content) = self._conn_request(conn, request_uri, method, body, headers)
  File "/usr/lib/python2.6/dist-packages/httplib2/__init__.py", line 871, in _conn_request
    response = conn.getresponse()
  File "/usr/lib/python2.6/httplib.py", line 988, in getresponse
    method=self._method)
  File "/usr/lib/python2.6/httplib.py", line 330, in __init__
    self.fp = sock.makefile('rb', 0)
AttributeError: 'NoneType' object has no attribute 'makefile'

Perhaps the HTTPResponse __init__ needs to check the sock arg before using it?

Or maybe would be better for HTTPConnection to check the socket validity before constructing a response with it?

Revision history for this message
dino99 (9d9) wrote :

Support for this version has ended

Changed in python2.6 (Ubuntu):
status: New → Invalid
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.