Skip to content

1 zombie #5352

@Inferik

Description

@Inferik

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

  1. Start Hiddify Manager
  2. Let it run normally (no special interaction required)
  3. Check process list:
ps aux | grep Z

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:

strace -p 8263 -e wait4

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:

.wait()

Suggested Fix

Replace usages of:

subprocess.Popen(...)

with either:

subprocess.run(...)

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions