Bug/Feature: Zombie process
Description: Describe bug or needed feature
Details:
Hiddify Version: 12.2.0b1
Python Version: 3.13.12 (main, Mar 24 2026, 22:49:35) [Clang 22.1.1 ]
OS: Linux-6.8.0-107-generic-x86_64-with-glibc2.39
User Agent: Chrome
Zombie process (sudo <defunct>) not reaped in Hiddify Manager 12.2.0b1
Description
I’ve noticed that Hiddify Manager leaves a zombie process (<defunct>) after invoking sudo. The issue appears to be caused by the parent Python process not calling wait() / waitpid() on a child process.
This results in a persistent zombie process that is never reaped as long as the main service is running.
Environment
- Hiddify Manager version: 12.2.0b1
- OS: Ubuntu 24.04
- Installation path:
/opt/hiddify-manager
- Service runtime: systemd
Steps to Reproduce
- Start Hiddify Manager
- Let it run normally (no special interaction required)
- Check process list:
Actual Result
A zombie process appears:
root 452612 0.0 0.0 0 0 ? Zs [sudo] <defunct>
Process tree:
python(8263)─┬─sudo(452612)
Detailed view:
ps -eo pid,ppid,state,cmd | grep Z
452612 8263 Z [sudo] <defunct>
The parent process is:
ps -fp 8263
hiddify+ 8263 1 ... /opt/hiddify-manager/.venv31
Debugging
Attaching strace to the parent process:
Produces no output, which indicates that the process does not call wait() / waitpid() to reap child processes.
Expected Behavior
All child processes (including sudo) should be properly reaped by the parent process using:
wait()
waitpid()
- or by using
subprocess.run() instead of subprocess.Popen() without .wait()
Impact
- Currently only 1 zombie process is present and it does not grow over time
- No immediate performance impact
- However, this indicates improper process handling and may lead to issues if similar patterns exist elsewhere
Possible Cause
Likely pattern in code:
subprocess.Popen(["sudo", ...])
without:
Suggested Fix
Replace usages of:
with either:
or ensure:
python
p = subprocess.Popen(...)
p.wait()
Alternatively, handle SIGCHLD properly.
This seems to be a minor issue (cosmetic in current behavior), but fixing it would improve process hygiene and prevent potential accumulation in future scenarios.
Bug/Feature: Zombie process
Description: Describe bug or needed feature
Details:
Hiddify Version: 12.2.0b1
Python Version: 3.13.12 (main, Mar 24 2026, 22:49:35) [Clang 22.1.1 ]
OS: Linux-6.8.0-107-generic-x86_64-with-glibc2.39
User Agent: Chrome
Zombie process (
sudo <defunct>) not reaped in Hiddify Manager 12.2.0b1Description
I’ve noticed that Hiddify Manager leaves a zombie process (
<defunct>) after invokingsudo. The issue appears to be caused by the parent Python process not callingwait()/waitpid()on a child process.This results in a persistent zombie process that is never reaped as long as the main service is running.
Environment
/opt/hiddify-managerSteps to Reproduce
ps aux | grep ZActual Result
A zombie process appears:
Process tree:
Detailed view:
The parent process is:
Debugging
Attaching
straceto the parent process:Produces no output, which indicates that the process does not call
wait()/waitpid()to reap child processes.Expected Behavior
All child processes (including
sudo) should be properly reaped by the parent process using:wait()waitpid()subprocess.run()instead ofsubprocess.Popen()without.wait()Impact
Possible Cause
Likely pattern in code:
without:
.wait()Suggested Fix
Replace usages of:
with either:
or ensure:
Alternatively, handle
SIGCHLDproperly.This seems to be a minor issue (cosmetic in current behavior), but fixing it would improve process hygiene and prevent potential accumulation in future scenarios.