Status: Resolved (View Workflow)
Affects Version/s: None
Fix Version/s: 1.0.0
Sprint:Horizon - October 17th 2018, Horizon - October 24th 2018, Horizon - October 31st 2018, Horizon - November 14th 2018, Horizon - November 21th 2018, Horizon - November 28th 2018
In the driver class an engine is created and registered as an alarm handler and an inventory handler. This registration occurs before the engine has had a chance to init. When the engine inits it uses the view of the inventory/alarms at the time that it was originally registered to complete its init.
This causes a race condition as it is possible for the engine to receive inventory/alarm callbacks before the init has occurred since it has already been registered as a callback handler. This means that the view from registration time may be stale by the time the engine inits which will lead to a corrupt view.
This example illustrates the race condition:
t1 - register and get inventory view
t2 - handleRemove callback called for some inventory item (no-op since not inited yet)
t3 - init with the view from t1
The resulting inventory view now contains the inventory item that should have been removed in t2 so now the engine is in an incorrect state.