os icon indicating copy to clipboard operation
os copied to clipboard

cargo now uses large amounts of memory when resolving packages leading to a oom

Open Lunarequest opened this issue 7 months ago • 1 comments

I build my blog using melange and wolfi as the base repos. Today I discovered my blog refused to build with the following in the logs

2025/05/28 18:21:26 WARN     Updating crates.io index
2025/05/28 18:21:32 WARN  Downloading crates ...
2025/05/28 18:21:32 WARN error: failed to download `stable-pattern v0.1.0`
2025/05/28 18:21:32 WARN
2025/05/28 18:21:32 WARN Caused by:
2025/05/28 18:21:32 WARN   Out of memory

I've tried downgrading the rust version but it seems this issue is still present. when using melange I see cargo using gigabytes of memory during the resolution process but when running cargo locally inside a container I do not see the memory issues I see with cargo in wolfi. I believe there is a regression in wolfi.

Lunarequest avatar May 28 '25 13:05 Lunarequest

I've confirmed with my desktop where it has 128 gigs of memory, I see the same behavior. where it takes large amounts of memory beyond what cargo should be taking and it has a OOM

Lunarequest avatar May 28 '25 14:05 Lunarequest

I'm also seeing this behavior, which seems to be at least temporally related to #54502 (but it only bumps the epoch?) . You can even see it occurring in rust package updates from the elastic-build workflow when building rust-based packages:

  • Zed: https://github.com/wolfi-dev/os/pull/54818#issuecomment-2923049928
  • Golem: https://github.com/wolfi-dev/os/pull/54815#issuecomment-2922932010

mccormickt avatar May 30 '25 18:05 mccormickt

I looked into this here: https://github.com/wolfi-dev/os/pull/54568#issuecomment-2919935990

TL;DR: I tried a bunch of workarounds but only updating to Rust 1.87 fixed it. Sadly our actual 1.87 build isn't ready yet and switching a bunch of stuff to rustup is probably the wrong solution.

AmberArcadia avatar May 30 '25 18:05 AmberArcadia

Thanks for looking into this @AmberArcadia! It seems like the llvm20 + rust 1.87 upgrades didn't quite solve this. I'm unfortunately still seeing OOMs from builds using the latest packages.

mccormickt avatar Jun 02 '25 18:06 mccormickt

Definitely a bummer to see that the issue was with our Rust build specifically, but my understanding is that this issue is now resolved via finding the buggy curl version and fixing it. Anyone else able to confirm we can close this out?

AmberArcadia avatar Jun 09 '25 17:06 AmberArcadia

I can confirm the issue seems to have resolved itself, in fact I've noticed a speed up in builds as well

Lunarequest avatar Jun 09 '25 17:06 Lunarequest