Skip to content
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

Open
kantai opened this issue Sep 17, 2021 · 6 comments
Open

Synchronization in event emitter between different events #2850

kantai opened this issue Sep 17, 2021 · 6 comments
Assignees
Labels

Comments

@kantai
Copy link
Member

kantai commented Sep 17, 2021

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!

@jcnelson
Copy link
Member

Related to #2183

@CharlieC3
Copy link
Member

Small correction, related to #2813, not 2183. :)

@stale
Copy link

stale bot commented Sep 21, 2022

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.

@stale stale bot added the stale label Sep 21, 2022
@stale
Copy link

stale bot commented Oct 22, 2022

This issue has been automatically closed. Please reopen if needed.

@stale stale bot closed this as completed Oct 22, 2022
@zone117x
Copy link
Member

Not stale

@jcnelson
Copy link
Member

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
Labels
Projects
Status: Status: 🆕 New
Development

No branches or pull requests

5 participants