-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Command .wait hanging on MacOS #6770
Comments
What happens when you run the equivalent code using |
@Darksonn std::process doesn't hang, please see below Code:
Output:
Code:
Output:
|
You need to compare it where they do it in exactly the same way. Otherwise the comparison is useless. Your Tokio version uses Also, please make sure to use codeblocks: I modified your latest post to do that, but please do it yourself in the future. |
@Darksonn , is this what you had in mind? If not, please let me know the code you'd like me to run. Code:
Output:
|
@Darksonn , what do you think of the example above? Thanks |
Sorry, I should have replied, but I forgot. I had a few other mac users try your example, and none of them were able to reproduce it. However, yesterday someone asked about a similar sounding issue. I'm thinking that there may have been some sort of change in the Rust standard library that's causing this. Are you able to try different rustc versions to see if it's fixed on older compilers? |
I have seen a similar issue, but I was only able to reproduce it in very restricted circumstances (but consistently!). The process remained as a zombie and the wait future never resolved. My case involved forking at the beginning of the program1 (to start a daemon process), then receiving a command over a UnixStream to spawn the process (
A comparison of syscalls (from dtruss) between the working and not-working calls gave nothing useful, though. My best guess is there's some kind of race condition in the internal Reaper implementation. The implementation on macos uses Footnotes
|
I'm sorry, but this is completely unsupported. Forking in this way is well known to cause problems specifically with Fork before you create your first runtime. |
Ah, that's unfortunate. After you pointed it our I searched and found #4301. The latest comment is exactly what I am doing, so when it becomes supported my workaround won't be necessary 🙂
|
@justin-elementlabs Did you find a solution to your issue? |
Version
│ │ │ └── tokio v1.39.2
│ │ │ └── tokio-macros v2.4.0 (proc-macro)
│ │ │ │ ├── tokio v1.39.2 ()
│ │ │ │ └── tokio-util v0.7.11
│ │ │ │ └── tokio v1.39.2 ()
│ │ │ ├── tokio v1.39.2 ()
│ │ │ ├── tokio v1.39.2 ()
│ │ │ ├── tokio-util v0.7.11 ()
│ │ │ ├── tokio v1.39.2 ()
│ │ │ ├── tokio v1.39.2 ()
│ │ │ └── tokio-rustls v0.24.1
│ │ │ └── tokio v1.39.2 ()
│ │ ├── tokio v1.39.2 ()
│ │ │ ├── tokio v1.39.2 ()
│ │ │ └── tokio-native-tls v0.3.1
│ │ │ └── tokio v1.39.2 ()
│ │ ├── tokio v1.39.2 ()
│ │ ├── tokio-native-tls v0.3.1 ()
│ │ ├── tokio-socks v0.5.1
│ │ │ └── tokio v1.39.2 ()
│ │ │ └── tokio v1.39.2 ()
│ │ ├── tokio v1.39.2 ()
│ │ ├── tokio-io-utility v0.7.6
│ │ │ └── tokio v1.39.2 ()
│ ├── tokio v1.39.2 ()
│ └── tokio-pipe v0.2.12
│ └── tokio v1.39.2 ()
│ │ │ └── tokio v1.39.2 ()
│ │ ├── tokio v1.39.2 ()
│ │ └── tokio-io-utility v0.7.6 ()
│ ├── tokio v1.39.2 ()
│ ├── tokio-io-utility v0.7.6 ()
│ └── tokio-util v0.7.11 ()
├── tokio v1.39.2 ()
└── tokio-process v0.2.5
├── tokio-io v0.1.13
├── tokio-reactor v0.1.12
│ ├── tokio-executor v0.1.10
│ ├── tokio-io v0.1.13 ()
│ └── tokio-sync v0.1.8
└── tokio-signal v0.2.9
├── tokio-executor v0.1.10 ()
├── tokio-io v0.1.13 ()
└── tokio-reactor v0.1.12 ()
Platform
Darwin Macusers-MBP.lan 23.5.0 Darwin Kernel Version 23.5.0: Wed May 1 20:14:38 PDT 2024; root:xnu-10063.121.3~5/RELEASE_ARM64_T6020 arm64
Description
It seems Tokio is not able to detect when a command returns on MacOS.
I tried this code:
use tokio::process::Command;
I expected to see this happen:
START
MIDDLE
hello world
the command exited with: status
END
Instead, this happened:
The process hangs at await and never resolves.
START
MIDDLE
hello world
test test has been running for over 60 seconds
The text was updated successfully, but these errors were encountered: