You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
EventQueue::add_event and event_handled encode the queue snapshot under the queue mutex, then call persist_queue after releasing it. VssStore::write takes the write version when it is called, so if a consumer reads the new event with next_event(), handles it, and calls event_handled() before the producer reaches KVStore::write, the producer's older snapshot (still holding the event) gets the higher version and becomes the persisted queue. A restart before the next queue write then replays the handled event.
next_event_async() only wakes after the producer's write completes, so this needs a polling consumer. Bitkit iOS polls next_event() because the async call cannot be cancelled from Swift (synonymdev/bitkit-ios#1395).
The window is the producer's synchronous path from dropping the lock to calling KVStore::write, so it is narrow, and handlers must already tolerate replayed events after a restart.
Fix: take the store write (and so its version) while the queue mutex is held, in add_event and event_handled.
Activity