feat: add a strategy to improve shuttle compatibility#171
Open
bdonlan wants to merge 2 commits intovorner:masterfrom
Open
feat: add a strategy to improve shuttle compatibility#171bdonlan wants to merge 2 commits intovorner:masterfrom
bdonlan wants to merge 2 commits intovorner:masterfrom
Conversation
Currently, ArcSwap does not integrate with the [`shuttle`] concurrency testing tool. While this doesn't _break_ code using shuttle, it also does not test for conditions such as retrying an `rcu` update. This change exposes a `ShuttleStrategy` based on the internal `RwLock<()>` strategy, which uses shuttle's `RwLock` primitive. This then allows shuttle to reorder operations on ArcSwap and expose races caused by these operations. [`shuttle`]: https://github.com/awslabs/shuttle
vorner
reviewed
Sep 14, 2025
Owner
vorner
left a comment
There was a problem hiding this comment.
Hello
I have few issues here:
- Shuttle is pre-1.0 crate. arc-swap is 1.0. Therefore, it shouldn't really have a dependency this way. I think it would make sense to include shuttle as part of the internal-test-strategies, which is clearly marked as not stable (I'm fine rewording it to be less scary).
- What are the plans of support / migration when new version of shuttle comes out?
- The shuttle strategy seems to be mostly a copy paste of the rw_lock one. I don't like the duplicate code. Also, why do you also enable the rw_lock module in case you enable the shuttle one?
Author
|
Author
|
Technically, we also depend on other aspects of the shttle API for our unit tests, but those would not be a breaking change to adjust, if the shuttle API were to change in the future. |
Author
|
@vorner Any further concerns on this one? |
vorner
reviewed
Sep 27, 2025
| /// [`shuttle`]: https://github.com/awslabs/shuttle | ||
| /// [`rcu`]: crate::ArcSwapAny::rcu | ||
| #[derive(Default)] | ||
| pub struct ShuttleStrategy { |
Owner
There was a problem hiding this comment.
I wonder if this wrapper serves an actual purpose. The real meat seems to be in the other module.
| @@ -0,0 +1,120 @@ | |||
| use shuttle::sync::RwLock; | |||
Owner
There was a problem hiding this comment.
I'd say the feature or module would deserve some documentation about what it is for and that it is considered unstable. I know the comment is somewhere within Cargo.toml, but that one isn't rendered at docs.rs and people usually don't read that one.
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.
Currently, ArcSwap does not integrate with the
shuttleconcurrency testing tool. While this doesn't break code using shuttle, it also does not test for conditions such as retrying anrcuupdate. This change exposes aShuttleStrategybased on the internalRwLock<()>strategy, which uses shuttle'sRwLockprimitive. This then allows shuttle to reorder operations on ArcSwap and expose races caused by these operations.This needs to be implemented in ArcSwap itself (rather than implementing it in shuttle) as the necessary traits are currently sealed.