From dddf74df9e684afc229a0e02fc7c142468eb2f23 Mon Sep 17 00:00:00 2001 From: Markus Zolliker Date: Tue, 26 Mar 2024 15:21:47 +0100 Subject: [PATCH] frappy.client: catch errors on callbacks buggy updates or errors in callbacks are now converted into error updates, buggy error updates are skipped. -> the receive thread should no longer crash Change-Id: I97e3999db73e64f73dfbc380fac3d7685b6ca31c Reviewed-on: https://forge.frm2.tum.de/review/c/secop/frappy/+/33386 Tested-by: Jenkins Automated Tests Reviewed-by: Alexander Zaft Reviewed-by: Markus Zolliker --- frappy/client/__init__.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/frappy/client/__init__.py b/frappy/client/__init__.py index ba85dc1..c828016 100644 --- a/frappy/client/__init__.py +++ b/frappy/client/__init__.py @@ -416,6 +416,14 @@ class SecopClient(ProxyClient): self.updateValue(module, param, value, timestamp, readerror) except KeyError: pass # ignore updates of unknown parameters + except Exception as e: + self.log.debug(f'error when updating %s:%s %r', module, param, value) + try: + # catch errors in callback functions + self.updateValue(module, param, None, timestamp, + type(e)(f'{e} - raised on client side')) + except Exception as ee: + self.log.warn(f'can not handle error update %r for %s:%s: %r', e, module, param, ee) if action in (EVENTREPLY, ERRORPREFIX + EVENTREPLY): continue try: