mirror of
https://github.com/chanzuckerberg/cellxgene.git
synced 2026-10-09 03:48:12 +08:00
Fix a deadlock when an exception is thrown during matrix validate/open (#1296)
This commit is contained in:
@@ -40,8 +40,14 @@ class MatrixDataCacheItem(object):
|
|||||||
self.data_lock.w_acquire()
|
self.data_lock.w_acquire()
|
||||||
# the data may have been loaded while waiting on the lock
|
# the data may have been loaded while waiting on the lock
|
||||||
if not self.data_adaptor:
|
if not self.data_adaptor:
|
||||||
self.loader.pre_load_validation()
|
try:
|
||||||
self.data_adaptor = self.loader.open(app_config)
|
self.loader.pre_load_validation()
|
||||||
|
self.data_adaptor = self.loader.open(app_config)
|
||||||
|
except Exception as e:
|
||||||
|
# necessary to hold the reader lock after an exception, since
|
||||||
|
# the release will occur when the context exits.
|
||||||
|
self.data_lock.w_demote()
|
||||||
|
raise e
|
||||||
|
|
||||||
# demote the write lock to a read lock.
|
# demote the write lock to a read lock.
|
||||||
self.data_lock.w_demote()
|
self.data_lock.w_demote()
|
||||||
|
|||||||
Reference in New Issue
Block a user