
couchdb-python - issue #224
Database.view() and list() don't work on Google's AppEngine
What steps will reproduce the problem? 1. setup a python appengine env 2. use the list() or view() functions 3.
What is the expected output? What do you see instead? The script get stuck on list() (or when you want iterate the result of view())
I think it is getting stuck on conn.getresponse() in http._try_request()
What version of the product are you using? On what operating system? 0.9
Please provide any additional information below.
Comment #1
Posted on May 20, 2013 by Grumpy DogAfter some investigation The problem is inside http:ResponseBody::close
the test below leads to an infinite loop
while not self.resp.isclosed():
self.resp.read(CHUNK_SIZE)
the httplib documentations says:
def isclosed(self): # NOTE: it is possible that we will not ever call self.close(). This # case occurs when will_close is TRUE, length is None, and we # read up to the last byte, but NOT past it. # # IMPLIES: if will_close is FALSE, then self.close() will ALWAYS be # called, meaning self.isclosed() is meaningful. return self.fp is None
AppEngine uses a custome version of httplib.
I dont know its behavior. But it returns True with the standard httplib and False on app engine (and makes an infinite loop)
Comment #2
Posted on May 20, 2013 by Grumpy Doghere my fix
def close(self): while not self.resp.isclosed(): chunk = self.resp.read(CHUNK_SIZE) if len(chunk) == 0: self.resp.close() if self.callback: self.callback() self.callback = None
Comment #3
Posted on Jul 15, 2014 by Quick RhinoThis issue has been migrated to GitHub. Please continue discussion here:
Status: New
Labels:
Type-Defect
Priority-Medium