Fix a deadlock when an exception is thrown during matrix validate/open (#1296)

This commit is contained in:
bmccandless
2020-03-25 15:49:49 -07:00
committed by GitHub
parent 674f14f9bd
commit 7b53209ae3
+8 -2
View File
@@ -40,8 +40,14 @@ class MatrixDataCacheItem(object):
self.data_lock.w_acquire()
# the data may have been loaded while waiting on the lock
if not self.data_adaptor:
self.loader.pre_load_validation()
self.data_adaptor = self.loader.open(app_config)
try:
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.
self.data_lock.w_demote()