-
Notifications
You must be signed in to change notification settings - Fork 679
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Synchronization in event emitter between different events #2850
Labels
Comments
Related to #2183 |
Small correction, related to #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. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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:
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 anew_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!
The text was updated successfully, but these errors were encountered: