Cargo builds cause system lockup

Hello,

I have a problem on my Debian 13 computer. I bought a new computer for Rust development, so it should be fast: Intel i5-14400, 32 GB RAM.

Once per day or so of working, while I'm running Cargo build, the computer hangs badly enough that I give up and power cycle it, usually after 15 minutes or so.

The computer is otherwise stable; it only hangs while running Cargo build.

I noticed that removing a large include_dir!() from my program reduced the frequency of lockups, but they are still occurring.

I'd hoped updating Rust would fix this, but this happened just now again after I updated from Rust 1.90 to 1.92, so I thought I'd ask.

I have noticed in the system monitor that the lag and hangs are associated with bizarre spikes in disk read, of 1 to 2 GB/sec sustained over many seconds, combined with all-cores CPU usage.

The same project builds OK sometimes, so I think it's probably a bug somewhere.

I have jobs = 6 set in my config.toml.

I wonder if it is a Btrfs bug (my boot drive is Btrfs SSD), but it just happened again after I moved my project to an external hard drive using ZFS. The Cargo package cache is still on the SSD.

Has anyone else seen this? Any idea what I can do to address it?

Thank you.

Possibilities that come to mind are incremental compilation bugs and type system inefficiencies (arguably bugs).

You could rule out the former by turning off incremental compilation to see if it still happens.

If the same code hangs sometimes and compiles fine sometimes, I don't think it can be the latter.

1 Like