rizinorg / cutter

Free and Open Source Reverse Engineering Platform powered by rizin
https://cutter.re
GNU General Public License v3.0
15.9k stars 1.15k forks source link

Debugger accumulates zombies #1934

Open karliss opened 4 years ago

karliss commented 4 years ago

Environment information

Describe the bug

Starting and stopping debugger causes Cutter to accumulate zombie processes.

To Reproduce

Steps to reproduce the behavior: 1.Open an ELF executable on Linux

  1. Start debuging using native debugger
  2. Click "Stop debug"
  3. Repeat steps 2-3 a few times
  4. View the process tree using your preferred tool, observe that Cutter has multiple child processes left from debugging in zombie state

Expected behavior Debugger correctly stops the process and performs required cleanup.

yossizap commented 4 years ago

Currently, doc kills and detaches from the child processes to end the debug session. Avoiding zombies isn't very straightforward if we are going to add a future configuration to let the child live after detach or if the child catches SIGKILL. I would like to see this solved but I am not sure if this is critical seeing that the zombies are cleaned up once Cutter/r2 is closed. A possible solution would be to wait for SIGCHLD with a timeout on detach.

AFAIK gdb solves this issue by maintaining a list of child prcesses but that won't work here.