I've done some experiments with:
1) multiprocessing.Process.join()
2) os.waitpid()
3) subprocess.Popen.wait()
These three methods behave completely different when interrupted with a signal which I find disturbing.
Reactions are:
1) exit with no exception or special return code
2) OSError exception
3) quiet retry (no exit)
The 1) case is very impractical.
Is there any movement towards standardization of those 3?
Now I know I can loop around Process.join() and check exitcode or is_alive, but it requires more code.
It has been pointed out that it changed between 2.6 and 2.7.
Associated bug: http://bugs.python.org/issue1731717
Relevant sources:
http://svn.python.org/view/python/branches/release26-maint/Lib/multiprocessing/forking.py?revision=84031&view=markup
http://hg.python.org/releasing/2.7.3/file/7bb96963d067/Lib/multiprocessing/forking.py
http://hg.python.org/cpython/rev/41aef062d529/
I think the behaviour of those three should be at least documented, especially if every one of them behaves differently and it changes between versions.
My environment is:
$ python --version
Python 2.7.3rc2
$ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description: Debian GNU/Linux 7.0 (wheezy)
Release: 7.0
Codename: wheezy
$ uname -a
Linux magazyn-ziarno 3.2.0-4-686-pae #1 SMP Debian 3.2.35-2 i686 GNU/Linux
Filing a bug as advised on python-dev mailing list (<kdmikh$h3h$1@ger.gmane.org>).
|