Description
From wickedg...@gmail.com on November 18, 2011 17:49:17
What steps will reproduce the problem? 1. connect to couchdb
2. fork() the python process
3. try to use the db in the child process What is the expected output? What do you see instead? The child gets exceptions like:
File "/usr/local/lib/python2.7/dist-packages/couchdb/client.py", line 1003, in rows
self._fetch()
File "/usr/local/lib/python2.7/dist-packages/couchdb/client.py", line 990, in _fetch
data = self.view._exec(self.options)
File "/usr/local/lib/python2.7/dist-packages/couchdb/client.py", line 880, in _exec
_, _, data = self.resource.get_json(**self._encode_options(options))
File "/usr/local/lib/python2.7/dist-packages/couchdb/http.py", line 394, in get_json
if 'application/json' in headers.get('content-type'):
TypeError: argument of type 'NoneType' is not iterable
and
File "/usr/local/lib/python2.7/dist-packages/couchdb/client.py", line 1003, in rows
self._fetch()
File "/usr/local/lib/python2.7/dist-packages/couchdb/client.py", line 990, in _fetch
data = self.view._exec(self.options)
File "/usr/local/lib/python2.7/dist-packages/couchdb/client.py", line 878, in _exec
**self._encode_options(options))
File "/usr/local/lib/python2.7/dist-packages/couchdb/http.py", line 401, in post_json
data = json.decode(data.read())
File "/usr/local/lib/python2.7/dist-packages/couchdb/http.py", line 94, in read
bytes = self.resp.read(size)
File "/usr/lib/python2.7/httplib.py", line 541, in read
return self._read_chunked(amt)
File "/usr/lib/python2.7/httplib.py", line 586, in _read_chunked
raise IncompleteRead(''.join(value))
httplib.IncompleteRead: IncompleteRead(1258 bytes read) What version of the product are you using? On what operating system? v0.8 on Ubuntu, python 2.7 Please provide any additional information below. I'm able to work around the problem by including code like the following under 0.8:
with my_db.resource.session.lock:
my_db.resource.session.conns = {}
Trunk has a connection pool object, so it looks like that would now be:
with my_db.resource.session.connection_pool.lock:
my_db.resource.session.connection_pool.conns = {}
Having this encapsulated in a public API function would be useful for us. :)
Thanks!
Original issue: http://code.google.com/p/couchdb-python/issues/detail?id=205