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:
parent
c8b92d5adb
commit
43a6997362
1 changed files with 3 additions and 1 deletions
|
@ -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
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue