Skip to content

Rustup OOM #5173

Open
Open

Description

@anisse

Verification

Problem

Rustup tends to get OOM killed on low-memory machines, in particular during unpacking.

In my case, it used 470MB in peak when it got killed:

> time -f '%M kB' rustup update
info: syncing channel updates for nightly-aarch64-unknown-linux-gnu
info: latest update on 2026-10-28 for version 1.101.0-nightly (41089d07a 2026-10-27)
info: removing previous version of component cargo
info: removing previous version of component clippy
info: removing previous version of component rust-docs
info: removing previous version of component rust-std
info: removing previous version of component rustc
info: removing previous version of component rustfmt
info: downloading 6 components
        rustc unpacking   [               ]   43.72 MiB (6.52 MiB/s, ETA: 0s)                                                                                                                                                                 Command terminated by signal 9
471628 kB

Kernel log:

kernel: Out of memory: Killed process 225841 (rustup) total-vm:1527460kB, anon-rss:471336kB, file-rss:0kB, shmem-rss:0kB, UID:1000 pgtables:1156kB oom_score_adj:0

This is on arm64, though I don't know if it changes much.

Steps

  1. Launch rustup update
  2. Watch it get sigkilled by the kernel for OOM reasons

Notes

This happened in the past, and a fix was merged this year in #4717 ; I don't think it works as intended, probably because detecting the ram_budget is not as trivial as it seems, especially with overcommit.

Possible Solution(s)

No response

Rustup version

rustup 1.29.2 (d8c92c676 2026-10-21)
info: This is the version for the rustup toolchain manager, not the rustc compiler.
info: the currently active `rustc` version is `rustc 1.99.1 (58cf8f9c3 2026-10-13)`

Installed toolchains

Default host: aarch64-unknown-linux-gnu
rustup home:  /home/aissen/.rustup

installed toolchains
--------------------
stable-aarch64-unknown-linux-gnu (active, default)
nightly-aarch64-unknown-linux-gnu

active toolchain
----------------
name: stable-aarch64-unknown-linux-gnu
active because: it's the default toolchain
installed targets:
  aarch64-unknown-linux-gnu

OS version

Debian GNU/Linux 12 (bookworm)

Activity

  1. rami3l commented on Oct 28, 2026

    @rami3l
    Member

    FTR we are using https://docs.rs/effective-limits/latest/effective_limits/fn.memory_limit.html for the budget thing; and since OOM killing is an OS behavior, I believe this process of preventing OOM is currently a best-effort one.

    For your immediate concern, maybe setting RUSTUP_IO_THREADS=1 will help?

  2. anisse commented on Oct 29, 2026

    @anisse
    Author

    Indeed, using RUSTUP_IO_THREADS=1 reduces the maximum memory impact:

    > env RUSTUP_IO_THREADS=1 /usr/bin/time -f '%M kB' rustup update
    info: syncing channel updates for nightly-aarch64-unknown-linux-gnu
    info: latest update on 2026-10-29 for version 1.101.0-nightly (92ffebece 2026-10-28)
    info: removing previous version of component cargo
    info: removing previous version of component clippy
    info: removing previous version of component rust-docs
    info: removing previous version of component rust-std
    info: removing previous version of component rustc
    info: removing previous version of component rustfmt
    info: downloading 6 components
          rustfmt installed                        2.23 MiB                                                                                                                                                                                       
      stable-aarch64-unknown-linux-gnu unchanged - rustc 1.99.1 (58cf8f9c3 2026-10-13)
       nightly-aarch64-unknown-linux-gnu updated - rustc 1.101.0-nightly (92ffebece 2026-10-28) (from (error reading rustc version))
    
    info: checking for self-update (current version: 1.29.2)
    info: cleaning up downloads & tmp directories
    232104 kB
  3. djc commented on Oct 30, 2026

    @djc
    Contributor

    It would be interesting if you can figure out why rustup's understanding of your environment's limits fails.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions