avoid deadlock in proxy
in secop.proxy the callers modules method announceUpdate is called from an other thread while the accessLock is locked, creating a deadlock. solve this by creating an other lock 'updateLock' for the update. + add status parameter even to non-Readable proxy modules, in order to indicate a failed connection + fix an error in secop_psi/softcal.py Change-Id: Iae7c6d5a74001150a47aa9dc99209c15d972cd5e Reviewed-on: https://forge.frm2.tum.de/review/c/sine2020/secop/playground/+/28130 Tested-by: Jenkins Automated Tests <pedersen+jenkins@frm2.tum.de> Reviewed-by: Enrico Faulhaber <enrico.faulhaber@frm2.tum.de> Reviewed-by: Markus Zolliker <markus.zolliker@psi.ch>
This commit is contained in:
@ -318,7 +318,8 @@ class Module(HasAccessibles):
|
||||
self.initModuleDone = False
|
||||
self.startModuleDone = False
|
||||
self.remoteLogHandler = None
|
||||
self.accessLock = threading.RLock()
|
||||
self.accessLock = threading.RLock() # for read_* / write_* methods
|
||||
self.updateLock = threading.RLock() # for announceUpdate
|
||||
self.polledModules = [] # modules polled by thread started in self.startModules
|
||||
errors = []
|
||||
|
||||
@ -495,7 +496,7 @@ class Module(HasAccessibles):
|
||||
def announceUpdate(self, pname, value=None, err=None, timestamp=None):
|
||||
"""announce a changed value or readerror"""
|
||||
|
||||
with self.accessLock:
|
||||
with self.updateLock:
|
||||
# TODO: remove readerror 'property' and replace value with exception
|
||||
pobj = self.parameters[pname]
|
||||
timestamp = timestamp or time.time()
|
||||
|
Reference in New Issue
Block a user