-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Sporadic kills with cargo run
on macOS 12
#10060
Comments
Cannot reproduce it on 12.1 Beta (x86_64). I think it's related to code signing or so, as this article describing. Could you check the attributes on the binary via |
I can't reproduce it now. I'm going to close this, as I don't think anyone else has reported it. I suspect it was just a temporary problem on my machine. I'll investigate more if it happens again. |
Started learning Rust this week and this has been happening the entire time intermittently. Exact symptoms and touch/run repro, except on Big Sur. Mac OS 11.6.0
Running the Idk if this is helpful but i tried changing the repro to
Even if the kill gets triggered, you can run the output binary directly |
Hm, strange, I can go ahead and reopen. https://developer.apple.com/forums/thread/663456 contains some investigation. I wonder if it is related to the way cargo hard-links the executable just before running it. |
facing this issue aswell, happens very randomly |
+1, i see something like this
Also interesting to note, I'm not on MacOS 12, only MacOS 11.5.2 |
I have the sameerror. I also got a log trace of when the issue happen.
Cargo version:
Mac os version: Big Sur 11.5.2 |
Signature using codesign
|
@charlesroussel The output looks fine. If you try to run it again, does it work? So far it looked more like a timing issue. |
Yes it works if I run it again. I am currently checking if it is related to hard linking/copy on write. From the issue:
Corresponding openRadar issue: https://openradar.appspot.com/FB8914243 |
Looking at cargo code on the copy/linking part. There is an interesting bit where the issue seems already detected. cargo/crates/cargo-util/src/paths.rs Lines 530 to 540 in e165bc8
|
Setting the env variable __CARGO_COPY_DONT_LINK_DO_NOT_USE_THIS is a working workaround |
|
I don't see why not. I can do the PR if you're ok with it. It definitely seems time-related or due to a race condition. running with Then I wanted to check the complete log. I disabled the privacy logging to have the path.
It bugs me that it is searching for this file |
Sure. I am not on the cargo team, but I think that would be the right course of action. |
I've encountered that issue while playing with the following Rust code:
The only thing I did was is renaming The error:
System logs:
RustC Version: Rust installation:
Brew info:
|
The number of execution before getting the error seems to be related to the binary size. This behaviour happens to me every 50 runs on a simple Helloworld and 1 in 4 on a bigger project. |
Add workaround for sporadic kills when building on Macos This is the workaround for the issue #10060
My PR was to linked to the issue. (I probably misconfigured something). |
Sure let's close this for now and we can reconsider it if it pops up again. |
Anyone following here: If you could let me know if you've been able to test out the latest nightly? Preferably in situations where it was failing before. I believe the fix is in nightly 2021-12-18. |
I reproduced the issue first on stable (1.57) using Then I called the same query for 2 hours on nightly, I could not reproduce.
|
I am able to recreate this quite reliably even with small projects. I haven't been able to recreate on nightly.
|
Problem
Since recently updating to macOS 12.0.1 (Monterey), I have been experiencing sporadic issues with security failures causing the kernel to kill the process before it starts.
In the logs, I see the following messages:
default 11:54:02.325853-0800 kernel ASP: Security policy would not allow process: 33133, /Users/eric/Proj/rust/toml-rs/scratch/a/target/debug/a-337f91948997ff1e
default 11:54:02.325856-0800 kernel ASP: Could not find reference 20142, process must have died
It happens very randomly. Sometimes it will happen constantly, and sometimes it might not happen for several minutes of repeated runs.
I'm not sure what "Could not find reference" means. Is that perhaps the pid of cargo itself?
Steps
Run
touch src/main.rs ; cargo run
a few times on a smallish project, like something that depends ontoml
.Possible Solution(s)
I haven't had a chance to investigate more. This doesn't happen on all projects (I haven't had a problem with building
cargo
for example). It doesn't seem to matter where I runcargo run
from (editor, terminal, etc.).Notes
No response
Version
The text was updated successfully, but these errors were encountered: