Skip to content
This repository has been archived by the owner on Feb 15, 2023. It is now read-only.

Killed: 9 (SIGKILL) on M1 Mac #110

Closed
n8henrie opened this issue May 3, 2022 · 1 comment
Closed

Killed: 9 (SIGKILL) on M1 Mac #110

n8henrie opened this issue May 3, 2022 · 1 comment

Comments

@n8henrie
Copy link

n8henrie commented May 3, 2022

Seems similar to #85 but without a build.rs script.

I've been trying to chase down NixOS/nixpkgs#162795 for months -- using nix for a reproducible Rust environment, I've been getting frequent Killed: 9 (SIGKILL) on M1 Mac.

In short, I've just discovered that if I remove the following from ~/.cargo/config.toml , the crashes instantly resolve:

[target.aarch64-apple-darwin]
rustflags = ["-C", "link-arg=-fuse-ld=/Users/n8henrie/.local/bin/zld"]

In my case, it seemed specific to rust 1.58.1 (the latest stable in nixpkgs) + zld, which is why I closed the nixpkgs issue earlier.

However, today I started again running into a rust project frequently crashing on cargo test with Killed: 9 (SIGKILL):

$ cargo test
   Compiling anyhow v1.0.51
   Compiling d11 v0.1.0 (/Users/n8henrie/git/aoc21-rust/d11)
    Finished test [unoptimized + debuginfo] target(s) in 1.64s
     Running unittests (/Users/n8henrie/git/aoc21-rust/target/debug/deps/d11-81afa5d4bfa2234e)
error: test failed, to rerun pass '--bin d11'

Caused by:
  process didn't exit successfully: `/Users/n8henrie/git/aoc21-rust/target/debug/deps/d11-81afa5d4bfa2234e` (signal: 9, SIGKILL: kill)
$ cargo --version
cargo 1.60.0 (d1fd9fe2c 2022-03-01)
$ zld -v
@(#)PROGRAM:zld  PROJECT:zld-
BUILD 13:50:05 Aug 23 2021
configured to support archs: i386 x86_64 x86_64h armv6 armv7 armv7s armv7m armv7k arm64
LTO support using: LLVM version 13.1.6, (clang-1316.0.21.2.3) (static support for 23, runtime is 28)
TAPI support using: Apple TAPI version 13.1.6 (tapi-1316.0.7.3)

Once I disabled zld, everything is working fine again.

I notice that #85 mentions some codesigning concerns; my nixpkgs issue also revealed some potential codesigning issues according to Console.app: NixOS/nixpkgs#162795 (comment)

Here's the repo I'm using for debugging and reproducing the issue: https://github.com/n8henrie/killed-9-example

On an M1 mac, if one

  • has zld enabled in ~/.cargo/config
  • clones that (small) repo
  • from that repo, uses nix-develop -i to enter a pretty well isolated build environment
  • runs ./crashme.sh, I imagine they can reproduce the crash

Afterwards, remove the zld-relevant lines from ~/.cargo/confg and re-run ./crashme.sh and the crash is resolved.

This is not a nix issue, I just thought its reproducible build environments might be helpful context for reproducibility (which is already going to be tough without access to an M1 mac).

The issue I encountered today was in https://github.com/n8henrie/aoc21-rust, specifically the d11 crate -- I was not using nix for this, it's a pretty simple crate with minimal external dependencies, and the crash was very frequent, resolved temporarily with a cargo clean, and resolved after removing zld from my ~/.cargo/config; I hope that the nix context doesn't muddy the waters too much.

@michaeleisel
Copy link
Owner

Closing, moving to #85

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants