[Bug 809145] [NEW] httplib.py crashed constructing an HTTPResponse for None socket

Bryce Harrington 809145 at bugs.launchpad.net
Tue Jul 12 05:36:35 UTC 2011


Public bug reported:

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?

** Affects: python2.6 (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to python2.6 in Ubuntu.
https://bugs.launchpad.net/bugs/809145

Title:
  httplib.py crashed constructing an HTTPResponse for None socket

Status in “python2.6” package in Ubuntu:
  New

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?

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/python2.6/+bug/809145/+subscriptions




More information about the foundations-bugs mailing list