Synchronization in event emitter between different events
Currently, the event emitter does not synchronize across threads, and some events are processed in different threads. This can lead to situations like the following:
Block A -> microblock 1
That is, microblock 1 depends on Block A. The node processes Block A and emits a new_block event for A, but before it does so, the thread that processes microblock events emits a new_microblock event for microblock 1. This race condition is possible because they process in two different threads.
Event observers could potentially handle this race condition by queueing microblock events, but the event emitter could also handle this condition by synchronizing across threads. Of course, this could be both dangerous (due to the new possibilities of deadlock) and performance degrading (due to serialization). However, I think the topic is worth discussing, so I'm opening this issue!
Related to #2183
Small correction, related to https://github.com/blockstack/stacks-blockchain/issues/2813, not 2183. :)
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
This issue has been automatically closed. Please reopen if needed.
Not stale
Temporarily assigning to @kantai so this has an owner. Please feel free to re-assign.