backup-container icon indicating copy to clipboard operation
backup-container copied to clipboard

MongoDB backups leave zombie processes

Open i5okie opened this issue 7 months ago • 0 comments

After executing a backup, the script leaves a zombie PID. Resulting in a growing list of zombie processes. With the current script, the process ID is lost after execution, so proper termination is not guaranteed.

    Container: backup-storage:
        PIDs:
        USER         PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
        1005440+ 2760703  0.0  0.0  66156 10980 ?        Ss   Jun24   0:00 python3 /usr/local/bin/docker-entrypoint.py /bin/sh -c bash /backup.sh
        1005440+ 2760773  0.0  0.0  13064  4020 ?        S    Jun24   0:00  \_ bash /backup.sh
        1005440+  582762  0.0  0.0      0     0 ?        Z    Jun25   0:00  \_ [mongod] <defunct>
        1005440+ 2219271  0.0  0.0      0     0 ?        Z    Jun26   0:00  \_ [mongod] <defunct>
        1005440+ 1895422  0.0  0.0      0     0 ?        Z    Jun27   0:00  \_ [mongod] <defunct>
        1005440+ 2794725  0.0  0.0      0     0 ?        Z    Jun28   0:00  \_ [mongod] <defunct>
        1005440+ 3928064  0.0  0.0      0     0 ?        Z    Jun29   0:00  \_ [mongod] <defunct>
        1005440+  389736  0.0  0.0      0     0 ?        Z    Jun30   0:00  \_ [mongod] <defunct>
        1005440+ 1036227  0.0  0.0      0     0 ?        Z    Jul01   0:00  \_ [mongod] <defunct>
        1005440+ 1800649  0.0  0.0      0     0 ?        Z    Jul02   0:00  \_ [mongod] <defunct>
        1005440+ 2494210  0.0  0.0      0     0 ?        Z    Jul03   0:00  \_ [mongod] <defunct>
        1005440+ 2227504  0.0  0.0      0     0 ?        Z    Jul04   0:00  \_ [mongod] <defunct>
...

Potential resolution:

  • Capture the PID of mongod process to ensure proper termination
  • Wait and ensure the process stops properly

i5okie avatar Jul 23 '24 23:07 i5okie