cargo icon indicating copy to clipboard operation
cargo copied to clipboard

`cargo test --no-run` sometimes gets SIGKILL out of thin air on MacOS

Open matklad opened this issue 3 years ago • 3 comments

Problem

In xshell, my macos builds fail fairly frequently with

command was terminated by a signal `cargo test --workspace --no-run`: 9

See, eg

https://github.com/matklad/xshell/runs/5529460783?check_suite_focus=true#step:4:22

What specifically happens here is that GitHub actions invokes cargo run --example ci, and that example recursively invokes cargo test --run, which then gets killed.

It seems like this is something we saw previously in https://github.com/rust-lang/cargo/issues/7821 and https://github.com/rust-lang/cargo/issues/10060.

Opening this issue to signal that this doesn't seem to be entirely fixed!

Steps

No response

Possible Solution(s)

No response

Notes

No response

Version

1.59.0

matklad avatar Mar 13 '22 20:03 matklad

Can you get the system logs? I don't know offhand how to get those from GitHub Actions. Normally I record them locally using console.app.

I see sh.remove_path("./target")?; in your script. One possibility is that the provenance for the executable is lost (for the temporary signatures). Perhaps consider using a separate target directory instead?

ehuss avatar Mar 13 '22 23:03 ehuss

This also happens to me, cargo t (I don't use --no-run) randomly dies:

failures:

---- src/lib.rs - (line 44) stdout ----
Test executable failed (signal: 9 (SIGKILL)).


failures:
    src/lib.rs - (line 44)

test result: FAILED. 4 passed; 1 failed; 0 ignored; 0 measured; 0 filtered out; finished in 1.45s

jjant avatar Jan 18 '23 13:01 jjant

I was also able to intermittently reproduce this when using cargo test --doc from this minimal example:

//! ```
//! use crate::this;
//! let foo = this::add(1,2);
//! assert_eq!(3, foo);
//! ```

pub fn add(left: usize, right: usize) -> usize {
    left + right
}

However, without anything changing on my system to my knowledge (i.e. the same session). It started succeeding without fail. Notably this was after I started trying to capture the system logs via Console.app.

M1 Pro, macOS Sonoma 14.5 (23F79)

nine9ths avatar Sep 24 '24 21:09 nine9ths