-
-
Notifications
You must be signed in to change notification settings - Fork 188
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 when reading localeCollection #3435
Avoid race-condition when reading localeCollection #3435
Conversation
The previous implementation was an example of a check-then-act race-condition: There is no guarantee that the cached value still exists when it is subsequently read out. This would cause errors later when `$this->localCollection` could suddenly have the value `false`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems edge-casey to me, but totally makes sense.
Just the tests need to be adjusted… |
This was happening many times a day in production for us before we implemented a mitigation 🤷🏻
Yeah, sorry, I had difficulty figuring out how to run them locally. I couldn't find any documentation on it, so I ended up reverse-engineering it from the Github Actions workflow. I found the error raised in the test quite confusing as well:
The issue was in fact the method name being used for the mocked cache 🤔 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for bringing that up again! Sorry I missed it yesterday with the tests and was too quick with the merge since it worked locally. 😅
Thanks for your contribution, and it’s great to hear that you still use Flow at famly.
Doh. Ok, to me it seems that cache should exist rather reliably… 🙈 |
The previous implementation was an example of a check-then-act race-condition: There is no guarantee that the cached value still exists when it is subsequently read out.
This would cause errors later when
$this->localeCollection
could suddenly have the valuefalse
.See #3188 for more context.
Checklist
FEATURE|TASK|BUGFIX
!!!
and have upgrade-instructions