torproject / stem

Python controller library for Tor
https://stem.torproject.org/
GNU Lesser General Public License v3.0
257 stars 75 forks source link

zombie processes after shutdown signal. #131

Closed 23cku0r closed 1 year ago

23cku0r commented 1 year ago

How to properly shutdown the tor process? I always have zombie processes

I use this to shutdown tor. изображение

And get zombie processes изображение

I use this to run tor and i dont have access to proc after изображение

atagar commented 1 year ago

Hi 23cku0r. To figure out what's up you'll need Tor's log. You can do so as follows. Replacing DEBUG with NOTICE to start with will likely be more helpful...

proc = stem.process.launch_tor_with_config(
  config = {
    'SocksPort': str(port),
    'ControlPort': str(get_control_port(port)),
    'Log': 'DEBUG file /tmp/tor_debug_log',
  }
)
23cku0r commented 1 year ago
atagar commented 1 year ago

Odd. Stem can't improve this (it simply issues the shutdown signal to the tor process). I'd suggest reaching out to the upstream project: https://support.torproject.org/misc/bug-or-feedback/

Sorry I can't be more help.

23cku0r commented 1 year ago

Replacing line 128 in process.py to tor_process = subprocess.Popen(' '.join(runtime_args), stdout = subprocess.PIPE, stdin = subprocess.PIPE, stderr = subprocess.PIPE, shell=True) fixes this problem