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

Race condition when records added through resonate lfi/rfi #97

Closed
dfarr opened this issue Nov 18, 2024 · 1 comment
Closed

Race condition when records added through resonate lfi/rfi #97

dfarr opened this issue Nov 18, 2024 · 1 comment

Comments

@dfarr
Copy link
Member

dfarr commented Nov 18, 2024

When new records are added to the scheduler via resonate.lfi or resonate.rfi we check for the existence of a record by id, and return a handle if one exists. If one does not exist we create a record - leading to a possible race condition.

Solution 1: ingest records in scheduler event loop

The event loop is single threaded, so race conditions can be avoided here. We would need to add information to a queue on the scheduler and await a handle. That handle would then be returned to the caller.

Solution 2: lock on the scheduler

We could a lock to the resonate class that must be obtained before lfis/rfis are added to the scheduler. Because we don't have to lock all concurrent calls, we could lock based on the id.

@Tomperez98
Copy link
Collaborator

We resolved this by adding a ForkOrJoin command and creating multiple handles with Subscribe and Notify

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

No branches or pull requests

2 participants