-
Notifications
You must be signed in to change notification settings - Fork 13k
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
regression: assertion left == right
failed but it depends on library-unstable details
#128899
Comments
It is probably the case that these include incorrect sort algorithm impls. I am bringing these to the attention of @orlp and @Voultapher if they wish to inspect the regressions further.
|
I think I am wrong for
bevy_serde_macros
Either way, these do not seem to be directly from the sort changes. |
I think the correct way to test that would be to do stable sort or |
Looking at the implementation, it sleeps for milliseconds, I fail to see how that could ever work reliably. The OS can decide to wake the threads up at some later point in time, sleep does not guarantee a fixed wakeup time. Plus it doesn't use latches, so it's spawn + sleep before the next thread is spawned. IMO that implementation is just plain broken. |
I'm a little surprised by how many instances there are of relying on the order of hashmaps, the order is randomized with the default hasher. Looking at the linked code they seem to be using the default hasher, how come these tests ever reliably work during local development? What am I missing here? |
I suspect it's just racy. I checked the project out locally and ran
Which is a completely different test, and the one in the crater run passed. Second run all tests pass. |
@workingjubilee I find the Note that the portion of the |
@orlp Thanks for catching that! I retract my comments re: "iterating over a hashmap" for that library, but it still seems very odd. |
Somewhat shockingly, the Project Euler code is also operating with a hashmap: https://github.com/chubei/project_euler/blob/d100bed4c6b7c417276ccba051567c53ed869d40/src/lib.rs#L39-L48 I really expected that one to be due to sorting issues...
There is a certain sort of person who only ever writes and runs a test once. I do not mean to accuse, but if they only ran the test a few times, it is possible the hashes happened to work out for them. Even if the hashing perfectly randomizes the keys, if you assert on the order of only 2 items, then it comes up as a coinflip either way. It's reasonable for that to pass 2-4 times in a row if you are lucky. |
I downloaded workpool and reran its tests a few times. It's another racy case. I think we've correctly identified racy library tests in:
And what seem to be definitely hashmap problems:
Unless these are fixed promptly, we should ignore those in future crater runs which cover tests. Correctly root-caused to the sort impl, but known accepted breakage:
MPCHomeControl is a float problem, so I'll bring it to #128898 That leaves the following as still open questions as to why the test is failing to begin with:
|
I haven't looked at these crates carefully. I know there are quite a few crates which are tested by crater that have test suites that are designed in various ways such that they are incompatible with multiple tests running at once. This would be fixed once and for all if crater would set the number of CPUs in each container to 1. |
It's a little off topic and if this turns into a bigger discussion let's please find a better place for it. My 2 cents, if your tests are order dependent and or can't be run in parallel they are broken. I'd rather tell these libraries "you choose to break the tooling's expectations, so you can't expect us to care for your use-case". Specifically with the racy libraries here I'm not sure it would even help:
|
I think it's our good friend hashmap order see, which constructs two hashmaps and does |
Is once again also hashmap order, the #[derive(Debug, Deserialize, Serialize, PartialEq)]
struct Names {
#[serde(
flatten,
deserialize_with = "super::deserialize_multi_btree::<'_, NumberedNames, _>",
serialize_with = "super::serialize_multi_btree::<NumberedNames, _>"
)]
names: BTreeMap<u32, String>,
#[serde(
flatten,
deserialize_with = "super::deserialize_additional_data::<'_, Names, _, _>"
)]
additional_data: HashMap<String, String>,
} Where the field #[derive(Debug, Deserialize, Serialize, PartialEq)]
struct Names {
#[serde(
flatten,
deserialize_with = "super::deserialize_multi::<'_, NumberedNames, _>",
serialize_with = "super::serialize_multi::<NumberedNames, _>"
)]
names: HashMap<u32, String>,
#[serde(
flatten,
deserialize_with = "super::deserialize_additional_data::<'_, Names, _, _>"
)]
additional_data: HashMap<String, String>,
} Now the fields |
Equality doesn't care about which order you check the keys in, the debug output is different but that shouldn't affect the comparison result. There seem to be extra spaces in the keys on one side, which I assume means the test itself is broken. EDIT: looking at it a little more, seems to be related to not accounting for whitespace in |
This is not a regression. Locally the tests Digging into why it fails, as example input that fails let's take In my opinion either the test does not test what the author wanted it to test, or the implementation does not do what the author intended it to do. |
Given the lack of active maintenance and sub 10k downloads, it might make sense to deny-list some of these crates that fail because of broken tests and or implementations. |
My bad, indeed the |
Would it be possible to add a |
left == right
for stuff that looks sorting relatedleft == right
failed because people iterate hashmaps
left == right
failed because people iterate hashmapsleft == right
failed because of comparisons that depend on library-unstable details
left == right
failed because of comparisons that depend on library-unstable detailsleft == right
failed but it depends on library-unstable details
I guess I retract my retraction regarding proxmox-api??? |
I guess we should test a revert of #125174 |
Hm, #125174 was cratered. |
The proxmox-api tests may work on the next crater run, so let's not exclude those. I've opened some PRs and issues on the relevant crates in the hopes of them fixing their code so that we can continue using their test data:
It seems unlikely these will all be resolved by the next beta crater run. In particular, the gaffer tests seem to be completely insoluble as it is an issue in essentially all the tests, so let's just skip that crate's tests from now on. |
I have opened some followups:
Everything else is accepted breakage, or (hopefully) will be published and fixed for the next beta crater, so I think we're done here. |
Thank you for playing, everyone! |
…, r=Mark-Simulacrum Exclude flakes found in beta 1.81 Details found in rust-lang/rust#128899
…kingjubilee Improve Ord docs - Makes wording more clear and re-structures some sections that can be overwhelming for someone not already in the know. - Adds examples of how *not* to implement Ord, inspired by various anti-patterns found in real world code. Many of the wording changes are inspired directly by my personal experience of being confused by the `Ord` docs and seeing other people get it wrong as well, especially lately having looked at a number of `Ord` implementations as part of rust-lang#128899. Created with help by `@orlp.` r? `@workingjubilee`
Rollup merge of rust-lang#129003 - Voultapher:improve-ord-docs, r=workingjubilee Improve Ord docs - Makes wording more clear and re-structures some sections that can be overwhelming for someone not already in the know. - Adds examples of how *not* to implement Ord, inspired by various anti-patterns found in real world code. Many of the wording changes are inspired directly by my personal experience of being confused by the `Ord` docs and seeing other people get it wrong as well, especially lately having looked at a number of `Ord` implementations as part of rust-lang#128899. Created with help by `@orlp.` r? `@workingjubilee`
The text was updated successfully, but these errors were encountered: