From 9aa7502b219d8ca637e00c67ea06634bac0cd4eb Mon Sep 17 00:00:00 2001 From: Eva Lott Date: Fri, 28 Jun 2024 14:44:04 +0100 Subject: [PATCH] fixed a race condition in the table update --- src/pandablocks_ioc/_tables.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/pandablocks_ioc/_tables.py b/src/pandablocks_ioc/_tables.py index 7a0c659a..07521df6 100644 --- a/src/pandablocks_ioc/_tables.py +++ b/src/pandablocks_ioc/_tables.py @@ -503,8 +503,12 @@ def update_table(self, new_values: List[str]) -> None: field_data, field_name, field_record.field ) - # Must skip processing as the validate method would reject the update - field_record.record_info.record.set(waveform_val, process=False) + # This check prevents an infrequent race condition that occurs when the table is + # updated with a value after the record is in the process of being updated already, + # resulting in the rejection of the second update's value. + if not np.array_equal(field_record.record_info.record.get(), waveform_val): + # Must skip processing as the validate method would reject the update + field_record.record_info.record.set(waveform_val, process=False) else: # No other mode allows PandA updates to EPICS records