lanto03 / couchdb-python

Automatically exported from code.google.com/p/couchdb-python
Other
0 stars 0 forks source link

AttributeError: 'NoneType' object has no attribute 'makefile' #121

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
I don't know where the error is, yet.  This is the traceback we see.  Somewhere 
between python-couchdb and httplib, the communication 
socket we're trying to use to talk to couchdb is not valid.

  File "/usr/lib/python2.6/dist-packages/desktopcouch/records/server_base.py", line 397, in view_exists
    view_container = self.db[doc_id]["views"]
  File "/usr/lib/pymodules/python2.6/couchdb/client.py", line 316, in __getitem__
    resp, data = self.resource.get(id)
  File "/usr/lib/pymodules/python2.6/couchdb/client.py", line 978, in get
    return self._request('GET', path, headers=headers, **params)
  File "/usr/lib/pymodules/python2.6/couchdb/client.py", line 1014, in _request
    resp, data = _make_request()
  File "/usr/lib/pymodules/python2.6/couchdb/client.py", line 1009, in _make_request
    body=body, headers=headers)
  File "/usr/lib/pymodules/python2.6/httplib2/__init__.py", line 1129, in request
    (response, content) = self._request(conn, authority, uri, request_uri, method, body, headers, redirections, cachekey)
  File "/usr/lib/pymodules/python2.6/httplib2/__init__.py", line 901, in _request
    (response, content) = self._conn_request(conn, request_uri, method, body, headers)
  File "/usr/lib/pymodules/python2.6/httplib2/__init__.py", line 871, in _conn_request
    response = conn.getresponse()
  File "/usr/lib/python2.6/httplib.py", line 984, 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'

Original issue reported on code.google.com by chadmill on 31 Mar 2010 at 4:25

GoogleCodeExporter commented 8 years ago
I've seen this, too, but it's intermittent AFAIK. Do you have a reproducible 
test case?

Original comment by djc.ochtman on 31 Mar 2010 at 4:31

GoogleCodeExporter commented 8 years ago
I have no test case, no.  I suspect that it's insufficient handling of EINTR, 
which 
Python std lib isn't very good at.

Original comment by chadmill on 31 Mar 2010 at 4:46

GoogleCodeExporter commented 8 years ago
I do have Python commit privs as well, so if you can come up with a solution 
for that...

Original comment by djc.ochtman on 31 Mar 2010 at 4:51

GoogleCodeExporter commented 8 years ago
I'm using desktop-couch here for gwibber (well, not using, but I'm packaging 
it). I
managed to get it to start once / twice, and now always see this error. 
Anything I
can provide to track it?

Original comment by dominiqu...@gmail.com on 10 Apr 2010 at 8:29

GoogleCodeExporter commented 8 years ago
Hey, dominique, I hope you can still reproduce this!

The exception handler just above the line referenced in the traceback 

'''File "/usr/lib/pymodules/python2.6/httplib2/__init__.py", line 871, in 
_conn_request'''

looks interesting to me.  Can you find out if you're arriving inside that 
exception 
handler, and what exception is raised?  I don't think it's good to be eating  
all 
socket.error exceptions that way.

Note, it's inside a retry loop.  Maybe the line *after* the exception handler 
should 
catch this AttributeError also.

I hope to spend some time on this next week.

Original comment by chadmill on 10 Apr 2010 at 1:43

GoogleCodeExporter commented 8 years ago
The current tip catches and retries on ECONNRESET and EPIPE. Do you think we 
should
retry on EINTR as well?

Original comment by djc.ochtman on 10 Apr 2010 at 4:05

GoogleCodeExporter commented 8 years ago
This is a known issue in httplib:

http://code.google.com/p/httplib2/issues/detail?id=62

Original comment by thisfred@gmail.com on 19 Apr 2010 at 10:46

GoogleCodeExporter commented 8 years ago
We no longer use httplib2, so I don't think that part applies here.

Original comment by djc.ochtman on 22 Dec 2010 at 11:59

GoogleCodeExporter commented 8 years ago
Okay, this is done.

Original comment by djc.ochtman on 21 Sep 2012 at 7:20