开发者

How do twisted and multiprocessing.Process create zombies?

开发者 https://www.devze.com 2023-03-18 09:52 出处:网络
In python, using twisted loopingcall, multipro开发者_JAVA技巧cessing.Process, and multiprocessing.Queue; is it possible to create a zombie process.And, if so, then how?A zombie is a process which has

In python, using twisted loopingcall, multipro开发者_JAVA技巧cessing.Process, and multiprocessing.Queue; is it possible to create a zombie process. And, if so, then how?


A zombie is a process which has completed but whose completion has not yet been noticed by the process which started it. It's the Twisted process's responsibility to reap its children.

If you start the process with spawnProcess, everything should always work as expected. However, as described in bug #733 in Twisted (which has long been fixed), there are a plethora of nasty edge-cases when you want to use Twisted with other functions that spawn processes, as Python's API historically made it difficult to cooperate between signal handlers.

This is all fixed in recent versions of the code, but I believe you may still encounter this bug in the following conditions:

  1. You are using a version of Twisted earlier than 10.1.
  2. You are using a version of Python earlier than 2.6.
  3. You are not building Twisted's native extension modules (if you're working from a development checkout or unpacked tarball rather than an installed version, you can fix this with python setup.py build_ext -i).
  4. You are using a module like popen or subprocess.

Hopefully upgrading Twisted or running the appropriate command will fix your immediate issue, but you should still consider using spawnProcess, since that lets you treat process output as a normal event in the reactor event loop.

0

精彩评论

暂无评论...
验证码 换一张
取 消