Build a new incr comp session dir from scratch every time - #159287
Build a new incr comp session dir from scratch every time#159287bjorn3 wants to merge 8 commits into
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
bf1a4e3 to
50ba28a
Compare
This comment has been minimized.
This comment has been minimized.
50ba28a to
68660f2
Compare
This comment has been minimized.
This comment has been minimized.
68660f2 to
1f2a9e3
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
1f2a9e3 to
e1094a1
Compare
e1094a1 to
d9dd28d
Compare
This comment has been minimized.
This comment has been minimized.
Rather than copying the old incr comp dir and then modifying it. This saves a copy/hardlink for files that are modified. And it removes the need for accurate work product tracking to avoid accumulating cruft, which is non-trivial. We don't accurately track the pre-LTO bitcode files for ThinLTO for example.
d9dd28d to
decf8a0
Compare
|
r? @nnethercote rustbot has assigned @nnethercote. Use Why was this reviewer chosen?The reviewer was selected based on:
|
It is already copied by copy_cgu_workproduct_to_incr_comp_cache_dir in Linker::link.
Missing work products should never happen, but if it does, clearly some corruption happened and we shouldn't try reusing the rest of the artifacts in the old session dir.
So another rustc instance can't remove it under our feet.
And unlock the old incr comp session dir after removing it.
|
Fwiw, I think this could also fix a nasty cache corruption bug I ran into when a rustc compile gets interrupted with incremental and opt-level >= 1. I had my agent whip up a quick repro here for anyone interested in digging deeper: https://github.com/lewisl9029/rustc-incremental-lto-repro TL;DR: it can either show cryptic errors that don't match the source, or (worse) successfully build a new binary that doesn't match the source, depending on what gets mixed up in the cache from unintentionally overwriting hardlinks pointing to previous finalized session state without a new finalized session taking its place (due to getting interrupted, even from just a ctrl+c, no SIGKILL needed). Rebuilding doesn't fix the issue either, only a cargo clean will. Originally encountered on 1.94.1, but still repros on 1.98.0. |
Rather than copying the old incr comp dir and then modifying it. This saves a copy/hardlink for files that are modified. And it removes the need for accurate work product tracking to avoid accumulating cruft, which is non-trivial. We don't accurately track the pre-LTO bitcode files for ThinLTO for example.
Part of rust-lang/compiler-team#908