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

Fix race conditions in queued Fire #68

Merged
merged 4 commits into from
Sep 6, 2023
Merged

Fix race conditions in queued Fire #68

merged 4 commits into from
Sep 6, 2023

Conversation

qmuntal
Copy link
Owner

@qmuntal qmuntal commented Aug 31, 2023

This PR reimplements how triggers are fired in queued mode to make it more robust to race conditions.

It contains learnings from #66, which supersedes.

Co-authored-by: qmuntal <quimmuntal@gmail.com>
Co-authored-by: liang-kang <kang_liang@qq.com>
@qmuntal qmuntal mentioned this pull request Aug 31, 2023
there exists a tiny gap between finishing iterations of firing queued event and sm.op decrease
If another routine run internalFireQueued in that gap,
it will not firing but save trigger in eventqueue and return
Meanwhile, origin routine will not check event queue again because interations has finished

so such trigger event will be left in queue and wait for later firing trigger to executing.
if no trigger again, this trigger event will wait for ever.
@liang-kang
Copy link
Contributor

This PR may break the rule of run-to-complete.

Try to fix it with #69

@qmuntal qmuntal merged commit aa77393 into master Sep 6, 2023
18 checks passed
@qmuntal qmuntal deleted the asyncqueued branch September 6, 2023 15:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants