-
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
Nondeterminism encountered in metadata for doc_link_resolutions #124357
Comments
cc @petrochenkov, who authored #94857. Can you think of any obvious places to check for sources of nondeterminism? |
Our determinism checker suddenly went stably green after #122053 was merged. |
It turns out there was another change in the Fuchsia source that landed in the same window between failing and passing runs that seems to have fixed the determinism issue (placing each rlib into its own exclusive directory in our build system). #122053 is not the critical change (false alarm). |
Just to check are you making sure that different crates with the same crate name have different |
@bjorn3 We do all of those things, or at least attempt to. I can't tell what's going on, but I'd much rather be able to point to specific rlibs of transitive dependencies than rely on a selection algorithm that can change based on the state of my build directory (whether the build is buggy or not). |
Since it looks like the nondeterminism was related to changes in inputs, I'm going to close this issue. |
It shouldn't change no matter what the state of the build directory is. We record a crate hash for each dependency and only load transitive dependencies matching this crate hash. Each unique rlib should get a unique crate hash no matter how small the change is. If that is not the case, there is a bug somewhere in rustc. If you were building two crates with the same crate name and |
It's possible the metadata keys aren't as unique as we thought. In any case it will be difficult to reproduce the issue outside of our build, and it's unlikely we will continue to investigate if we aren't seeing more determinism failures. IMO the compiler forcing the use of search directories hinders debugging and reproducibility. I'd much rather point it to individual files and rely on such hashing mechanisms as a backup / error detection only. |
Fuchsia has a test that checks whether rustc output is deterministic, and we find that it fairly reliably reorders bits of the metadata output for
doc_link_resolutions
for one particular crate in our build.I determined this by picking out some changes of d5bd169 to add
RUSTC_FILE_ENCODER_PANIC_AT_OFFSET
and examining the backtrace at an offset that differs in one failure in the hexdump below. I also grepped for the strings that appear in all of the differences.[`std::ops::Deref`]
.Lines are from compiler commit 7f2fc33. Source code of the crate is available here.
Full backtrace
In the following diff, the first version (red) is more common.
The text was updated successfully, but these errors were encountered: