Closed
Conversation
|
I'll analyze this and get back to you. |
Contributor
Author
How to use the Graphite Merge QueueAdd the label mergequeue to this PR to add it to the merge queue. You must have a Graphite account in order to use the merge queue. Sign up using this link. An organization admin has enabled the Graphite Merge Queue in this repository. Please do not merge from GitHub as this will restart CI on PRs being processed by the merge queue. This stack of pull requests is managed by Graphite. Learn more about stacking. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2814 +/- ##
==========================================
+ Coverage 74.67% 74.69% +0.02%
==========================================
Files 385 385
Lines 49762 49774 +12
==========================================
+ Hits 37158 37181 +23
+ Misses 12604 12593 -11 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
84c325b to
802233d
Compare
802233d to
3bda50f
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


tl;dr
load_mls_group_with_lockdoes not return an error or wait if the group is already locked (synchronously or asynchronously)load_mls_group_with_lockwithload_mls_group...which does basically the same thing as the old version but more honestly.The issue
Previously
load_mls_group_with_lockwould callget_lock_sync, which returns an error. But it ignored the result and wouldn't return if it failed. That means that if anyone had already acquired the lock, it would do nothing.If you were the only lock holder you could block someone from calling
load_mls_group_with_lock_async, which does successfully wait until the lock was released. But even that would only respect the first caller ofload_mls_group_with_lock, so it isn't a functional semaphore orRwLock either.Why not just fix the bug?
I decided to change to the new
load_mls_groupin most cases for a few reasons.load_mls_group_with_lockfrom inside the callbacks toload_mls_group_with_lock_asyncload_mls_group_with_lockare for read-only data. If an app wants to callgroup.members()they don't want (and can't) coordinate their calls around whether or not we are syncing or receiving messages from a stream. If this lock actually worked it would make our SDKs extremely flaky since we would be returning lock errors everywhere.So, this is safe?
I'm not so sure. We have to thoroughly audit all usage of any method that previously called any of the methods that relied on
load_mls_group_with_lockand make sure that they shouldn't actually be taking out a lock (and erroring if one isn't available) or using the async method and waiting until the lock becomes available. We generally useload_mls_group_with_lock_asyncfor heavy lifting...but maybe not exclusively. So we shouldn't merge this without some more investigation tomorrow.Other notes
load_mls_group...but I probably should just make it a regular function.