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

Question: How is it possible to end up with defunct proceses using async_process::Command with the default reap_on_drop? #92

Open
boombatower opened this issue Jan 10, 2025 · 0 comments

Comments

@boombatower
Copy link

boombatower commented Jan 10, 2025

Presumably, I am missing something, but I haven't been able to put my finger on it. During testing and intentionally trying to not await spawn()'d processes I have been unable to create zombie processes, but during long-running tests I eventually get defunct rsync processes.

Everything is immediately await'd and I even tried not awaying and just dropping the variable. I am not seeing how I end up with defunct processes.

Using ps -ejf I see my main process PID 1 since in a container and then PPID of all the defunct rsync processes of 1. The main processes spawns thousands of rsync calls over the course of hours...almost all of which work and are cleaned up, but for some reason I end up with some that don't.

UID         PID   PPID   PGID    SID  C STIME TTY          TIME CMD
root          1      0      1      1  0  2024 ?        00:01:28 /my-rust-app
root        163      1      1      1  0  2024 ?        00:00:00 [rsync] <defunct>
root        164      1      1      1  0  2024 ?        00:00:00 [rsync] <defunct>
root        256      1      1      1  0  2024 ?        00:00:00 [rsync] <defunct>
root        257      1      1      1  0  2024 ?        00:00:00 [rsync] <defunct>
root        302      1      1      1  0  2024 ?        00:00:00 [rsync] <defunct>
root        303      1      1      1  0  2024 ?        00:00:00 [rsync] <defunct>
root        423      1      1      1  0  2024 ?        00:00:00 [rsync] <defunct>
root        424      1      1      1  0  2024 ?        00:00:00 [rsync] <defunct>
root       1025      1      1      1  0  2024 ?        00:00:00 [rsync] <defunct>
root       1026      1      1      1  0  2024 ?        00:00:00 [rsync] <defunct>
root       1258      1      1      1  0  2024 ?        00:00:00 [rsync] <defunct>
root       1259      1      1      1  0  2024 ?        00:00:00 [rsync] <defunct>
root       1276      1      1      1  0  2024 ?        00:00:00 [rsync] <defunct>
root       1277      1      1      1  0  2024 ?        00:00:00 [rsync] <defunct>
root       1296      1      1      1  0  2024 ?        00:00:00 [rsync] <defunct>
root       1297      1      1      1  0  2024 ?        00:00:00 [rsync] <defunct>

What scenario would need to occur to cause this and perhaps I can sort out how I am pulling that off.

Command::new("/usr/bin/rsync")
  .args([...])
  .current_dir(...)
  .env_clear()
  .kill_on_drop(true)
  .spawn()
@boombatower boombatower changed the title Question: How is it possible to end up with defunct processing using async_process::Command with the default reap_on_drop? Question: How is it possible to end up with defunct proceses using async_process::Command with the default reap_on_drop? Jan 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant