Fix deadlock on shutdown by releasing the GIL during del

On delete rocksdb waits for the background thread to finish.
However the background threads needs the GIL to execute python-code
(for example comparator)
=>
* main thread has GIL
* main thread waits for background thread
* background thread tries to get GIL
which means deadlock
This commit is contained in:
hofmockel 2014-01-24 17:03:14 +01:00
parent c8b92d5adb
commit 43a6997362

View file

@ -1095,7 +1095,9 @@ cdef class DB(object):
def __dealloc__(self): def __dealloc__(self):
if not self.db == NULL: if not self.db == NULL:
del self.db with nogil:
del self.db
if self.opts is not None: if self.opts is not None:
self.opts.in_use = False self.opts.in_use = False