jur9526 / couchdb-python

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

KeyError when resolving conflicts #204

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Run the attached script couch.py

What is the expected output? What do you see instead?
I expect to see conflicts resolved resulting in doc with value=10
Instead I get KeyError: 'http://localhost:5984/keyerror_test/test'
from:
/couchdb/http.py", line 251, in request
    del self.cache[url]

What version of the product are you using? On what operating system?
couchdb-python 0.8, python 2.7, Ubuntu 11.04

Please provide any additional information below.

I can fix this issue by changing lint 251 of http.py to 

try:
    del self.cache[url]
except KeyError, e:
    pass

I guess this is a threading issue as self.cache has been altered between line 
165 and line 251. Is it even valid to use couchdb-python in this way?

Note, I originally discovered this in my Pylons web app when I would get this 
exception during a Mapping.load(db, id) call.

Original issue reported on code.google.com by d...@playcanvas.com on 16 Nov 2011 at 3:18

Attachments:

GoogleCodeExporter commented 9 years ago
couchdb.http.Session does attempt to be thread-safe so I'd definitely say 
you're using it just fine and this is a bug. Thanks for reporting!

Original comment by matt.goo...@gmail.com on 16 Nov 2011 at 5:43

GoogleCodeExporter commented 9 years ago

Original comment by djc.ochtman on 21 Sep 2012 at 8:32

GoogleCodeExporter commented 9 years ago

Original comment by wickedg...@gmail.com on 22 Sep 2012 at 12:45

GoogleCodeExporter commented 9 years ago
Fixed in r4c4d3ecf896b

Original comment by kxepal on 5 Oct 2012 at 8:31