rust-lang / rust-lang/rust

opt-dist disk usage broken

Open
#159,534 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

A-opt-dist C-bug T-bootstrap
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Our disk usage calculation in opt-dist (https://github.com/rust-lang/rust/blob/8a3308ed506be56b8157dfc9242a145153331296/src/tools/opt-dist/src/utils/mod.rs#L18) assumes that distinct disks will not be reported twice. However, currently sysinfo will report docker mounts (overlay fs) in addition to the main disk, leading to buggy double-counting:

$ docker run --rm -it -v `pwd`:/mnt ubuntu:26.04 /mnt/target/debug/check-sysinfo
Emulate Docker CLI using podman. Create /etc/containers/nodocker to quiet msg.
[src/main.rs:3:9] disk = Disk("/dev/root")[FS: "ext4"][Type: Unknown(-1)][removable: no][I/O: DiskUsage { total_written_bytes: 0, written_bytes: 0, total_read_bytes: 0, read_bytes: 0 }] mounted on "/mnt": 225873375232/311227166720 B
[src/main.rs:4:9] humansize::format_size(disk.available_space(), humansize::BINARY) = "210.36 GiB"
[src/main.rs:3:9] disk = Disk("overlay")[FS: "overlay"][Type: Unknown(-1)][removable: no][I/O: DiskUsage { total_written_bytes: 0, written_bytes: 0, total_read_bytes: 0, read_bytes: 0 }] mounted on "/": 225873375232/311227166720 B
[src/main.rs:4:9] humansize::format_size(disk.available_space(), humansize::BINARY) = "210.36 GiB"

I suspect this is also the root cause of why Crater keeps filing up its disks... cc https://github.com/rust-lang/crater/issues/762

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at src/tools/opt-dist/src/utils/mod.rs#L18 and reproduce the duplicate disk reporting with the Docker command shown in the issue. Inspect how opt-dist consumes sysinfo disk entries; done means disk usage is no longer double-counted when overlay and main-disk mounts report the same space.

Written by the indexing model from the issue text.

Assessment

Tech stack
docker, rust
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.