Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting SIGSEGV with Rust 1.47.0 on macos #77849

Closed
sagacity opened this issue Oct 12, 2020 · 5 comments
Closed

Getting SIGSEGV with Rust 1.47.0 on macos #77849

sagacity opened this issue Oct 12, 2020 · 5 comments
Labels
A-spurious Area: Spurious failures in builds (spuriously == for no apparent reason) C-bug Category: This is a bug. E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. O-macos Operating system: macOS regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@sagacity
Copy link

sagacity commented Oct 12, 2020

I'm getting intermittent SIGSEGV: invalid memory reference crashes when compiling projects. This has started happening when upgrading from 1.46.0 (stable) to 1.47.0 (stable) on MacOS.

For instance, compiling the master branch of https://github.com/gfx-rs/wgpu-rs:
cargo run --example cube

error: could not compile syn.

Caused by: process didn't exit successfully: rustc --crate-name syn --edition=2018 /Users/rjacobs/.cargo/registry/src/git.luolix.top-1ecc6299db9ec823/syn-1.0.31/src/lib.rs --error-format=json --json=diagnostic-rendered-ansi --crate-type lib --emit=dep-info,metadata,link -C embed-bitcode=no -C debuginfo=2 --cfg 'feature="clone-impls"' --cfg 'feature="default"' --cfg 'feature="derive"' --cfg 'feature="extra-traits"' --cfg 'feature="full"' --cfg 'feature="parsing"' --cfg 'feature="printing"' --cfg 'feature="proc-macro"' --cfg 'feature="quote"' --cfg 'feature="visit"' -C metadata=3015984c4aad08eb -C extra-filename=-3015984c4aad08eb --out-dir /Users/rjacobs/sandbox/wgpu-rs/target/debug/deps -L dependency=/Users/rjacobs/sandbox/wgpu-rs/target/debug/deps --extern proc_macro2=/Users/rjacobs/sandbox/wgpu-rs/target/debug/deps/libproc_macro2-ca449e9a62227554.rmeta --extern quote=/Users/rjacobs/sandbox/wgpu-rs/target/debug/deps/libquote-4e89379d9f53f035.rmeta --extern unicode_xid=/Users/rjacobs/sandbox/wgpu-rs/target/debug/deps/libunicode_xid-4f1ac68564fd7c97.rmeta --cap-lints allow --cfg syn_disable_nightly_tests (signal: 11, SIGSEGV: invalid memory reference)`

If I simply start the build again with cargo run --example cube eventually it will compile and run correctly. Also, in the above example it's syn that fails, but other crates may also cause the crash randomly.

Sometimes I'm also getting panics in rustc instead of SIGSEGV. I assume this is related to miscompilation in an earlier stage. I can't really add too many other details since I'm no debugging expert on MacOS but I'm happy to run some debugging commands to help.

rustc --version --verbose:
rustc 1.47.0 (18bf6b4 2020-10-07)
binary: rustc
commit-hash: 18bf6b4
commit-date: 2020-10-07
host: x86_64-apple-darwin
release: 1.47.0
LLVM version: 11.0

@Mark-Simulacrum Mark-Simulacrum added C-bug Category: This is a bug. E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example regression-from-stable-to-stable Performance or correctness regression from one stable version to another. labels Oct 12, 2020
@rustbot rustbot added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Oct 12, 2020
@Mark-Simulacrum Mark-Simulacrum added I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. and removed I-prioritize Issue: Indicates that prioritization has been requested for this issue. labels Oct 12, 2020
@jyn514
Copy link
Member

jyn514 commented Oct 12, 2020

SEGV sounds like it might be running out of memory - do you know how much memory it takes up when compiling this project? free -h will tell you, or command time -v cargo build.

@sagacity
Copy link
Author

sagacity commented Oct 12, 2020

@jyn514 max memory reported by zsh time is approx 680MiB for the wgpu build, which doesn't indicate out of memory.

After rebooting my laptop I'm not seeing these crashes anymore, though. Perhaps it was running out of memory before the reboot, but there was nothing in the system indicating a lack of resources.

I'll see if I can artificially reduce available memory and see if I can reproduce.

@sagacity
Copy link
Author

Even with significant memory pressure (via the memory_pressure tool) I can't reproduce the issue anymore.

This could mean two things imo:

  • I just had some rogue kernel extension on my machine stomping on memory somehow
  • The crashes are somehow related to where in memory the compilation process is running

Neither seem very likely, but I guess that's all I can do for now. Feel free to close this ticket if you agree, otherwise I'm happy to do some more experiments.

@jyn514 jyn514 added the A-spurious Area: Spurious failures in builds (spuriously == for no apparent reason) label Oct 12, 2020
@camelid camelid added the O-macos Operating system: macOS label Oct 12, 2020
@LeSeulArtichaut LeSeulArtichaut added the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Oct 14, 2020
@apiraino
Copy link
Contributor

@RoyJacobs feel free to report back if you can reproduce the issue again. Also, you might want to subscribe to linked issue #77869

@spastorino spastorino added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Oct 14, 2020
@apiraino apiraino removed the I-prioritize Issue: Indicates that prioritization has been requested for this issue. label Oct 28, 2020
@workingjubilee
Copy link
Member

In the absence of a reproducible example, I'm going to close this.

@workingjubilee workingjubilee closed this as not planned Won't fix, can't repro, duplicate, stale Jul 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-spurious Area: Spurious failures in builds (spuriously == for no apparent reason) C-bug Category: This is a bug. E-needs-bisection Call for participation: This issue needs bisection: https://github.com/rust-lang/cargo-bisect-rustc E-needs-mcve Call for participation: This issue has a repro, but needs a Minimal Complete and Verifiable Example I-crash Issue: The compiler crashes (SIGSEGV, SIGABRT, etc). Use I-ICE instead when the compiler panics. O-macos Operating system: macOS regression-from-stable-to-stable Performance or correctness regression from one stable version to another. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

9 participants