# HG changeset patch # User Edouard Tisserant # Date 1659434017 -7200 # Node ID d74eb1be6abe3ca54e9aeea8ffbc5d786f353ce5 # Parent 6c7a7b22bec91b4f0455f738167667a94d681c60 Runtime: Fix PLC python thread crash in case of exception in PostStart customization hook. diff -r 6c7a7b22bec9 -r d74eb1be6abe runtime/PLCObject.py --- a/runtime/PLCObject.py Tue Aug 02 11:50:54 2022 +0200 +++ b/runtime/PLCObject.py Tue Aug 02 11:53:37 2022 +0200 @@ -466,7 +466,7 @@ self.PythonThreadAcknowledge(cmd) self.PythonRuntimeCall("start") self.LogMessage("Python extensions started") - self.PostStartPLC() + self._PostStartPLC() self.PythonThreadLoop() self.PythonRuntimeCall("stop", reverse_order=True) elif cmd == "Finish": @@ -504,6 +504,13 @@ """ pass + def _PostStartPLC(self): + try: + self.PostStartPLC() + except Exception: + self.LogMessage(0, 'Post Start Exception'+'\n'.join( + traceback.format_exception(*sys.exc_info()))) + def PostStartPLC(self): """ Here goes actions to be taken after PLC is started,