-
Notifications
You must be signed in to change notification settings - Fork 15.4k
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
Refactor the object cache to better account for race conditions #13204
Closed
Commits on Jul 4, 2023
-
Ruby: Refactor the object cache to better account for race conditions
Superseeds: protocolbuffers#13054 The object cache is fundamentally subject to race conditions. Objects must be created before they are registered into the cache, so if two threads try to create the same object, we'll inevitably end up with two instances mapping to the same underlying memory. To entirely prevent that we'd need a lot of extra locking which I don't think is really worth it compared to a few useless allocations. Instead we can replace `ObjectCache_Add` by a `getset` type of operation, the extra instance is still created, but the later threads will receive the "canonical" instance and will be able to abandon their duplicated instance. Additionally, this PR moves the ObjectCache implementation in Ruby, as it's much easier to debug there, and the performance difference is negligible. The `ObjectCache` instance is also exposed as `Google::Protobuf::OBJECT_CACHE` to better allow to debug potential memory issues.
Configuration menu - View commit details
-
Copy full SHA for 83942c1 - Browse repository at this point
Copy the full SHA 83942c1View commit details -
Configuration menu - View commit details
-
Copy full SHA for a7fcb44 - Browse repository at this point
Copy the full SHA a7fcb44View commit details -
Configuration menu - View commit details
-
Copy full SHA for ee7a450 - Browse repository at this point
Copy the full SHA ee7a450View commit details
Commits on Jul 5, 2023
-
Configuration menu - View commit details
-
Copy full SHA for c55775b - Browse repository at this point
Copy the full SHA c55775bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 3f82dfe - Browse repository at this point
Copy the full SHA 3f82dfeView commit details -
Configuration menu - View commit details
-
Copy full SHA for 999ab1a - Browse repository at this point
Copy the full SHA 999ab1aView commit details
Commits on Jul 7, 2023
-
Configuration menu - View commit details
-
Copy full SHA for e40194c - Browse repository at this point
Copy the full SHA e40194cView commit details -
Merge pull request #1 from JasonLunn/for_kfm
Add unit tests for ObjectCache.
Configuration menu - View commit details
-
Copy full SHA for 637ffdb - Browse repository at this point
Copy the full SHA 637ffdbView commit details
Commits on Jul 8, 2023
-
Configuration menu - View commit details
-
Copy full SHA for 3b5b751 - Browse repository at this point
Copy the full SHA 3b5b751View commit details -
Configuration menu - View commit details
-
Copy full SHA for 4867e20 - Browse repository at this point
Copy the full SHA 4867e20View commit details -
Configuration menu - View commit details
-
Copy full SHA for 19f6d4b - Browse repository at this point
Copy the full SHA 19f6d4bView commit details -
Configuration menu - View commit details
-
Copy full SHA for 9b6aad6 - Browse repository at this point
Copy the full SHA 9b6aad6View commit details
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.