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

Avoid race condition(s) #56

Merged
merged 2 commits into from
Mar 24, 2022
Merged

Avoid race condition(s) #56

merged 2 commits into from
Mar 24, 2022

Conversation

alerque
Copy link
Member

@alerque alerque commented Mar 23, 2022

Closes #52
Closes #54

@alerque
Copy link
Member Author

alerque commented Mar 23, 2022

@arichard4 Any chance you could take a gander at my fix here? It works but I'm not 100% sure why in multi-threading mode the stage.run() is even getting called with an empty state object.

@alerque alerque changed the title Avoid race condition Avoid race condition(s) Mar 23, 2022
@alerque alerque force-pushed the threadsafe branch 2 times, most recently from 6d8563f to f0bcdd3 Compare March 24, 2022 06:45
Trying to stash the state outside of the function and access it from any
other scope creates problems for multi-threaded runs. Passing it around
in the function calls keeps it local to the current scope even when/if
more than one may be running.
@alerque alerque merged commit 17ec37a into master Mar 24, 2022
@alerque alerque deleted the threadsafe branch March 24, 2022 09:51
@arichard4
Copy link

Makes sense, thanks!

@alerque
Copy link
Member Author

alerque commented Mar 24, 2022

Thanks for the review. And sorry I should have commented as well, but my first "work around" posted here when I first pinged you was a pretty dirty hack. I later figured out a way to accomplish the same thing without it feeling dirty and things made much more sense, which is why I went ahead with the merge and release.

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

Successfully merging this pull request may close these issues.

Serious regression from PR 46 luacheck: Fails due to cache write race condition
2 participants