This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Inconsistent behaviour of methods waiting for child process
Type: behavior Stage: resolved
Components: Versions: Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: jwilk, python-dev, sbt, wodny
Priority: normal Keywords:

Created on 2013-01-23 15:15 by wodny, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (2)
msg180465 - (view) Author: Marcin Szewczyk (wodny) Date: 2013-01-23 15:15
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>).
msg183051 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2013-02-26 13:13
New changeset 92003d9aae0e by Richard Oudkerk in branch '2.7':
Issue #17018: Make Process.join() retry if os.waitpid() fails with EINTR.
http://hg.python.org/cpython/rev/92003d9aae0e

New changeset 5fae31006724 by Richard Oudkerk in branch '3.2':
Issue #17018: Make Process.join() retry if os.waitpid() fails with EINTR.
http://hg.python.org/cpython/rev/5fae31006724
History
Date User Action Args
2022-04-11 14:57:40adminsetgithub: 61220
2013-06-20 14:51:14sbtsetstatus: open -> closed
resolution: fixed
stage: resolved
2013-02-26 13:13:10python-devsetnosy: + python-dev
messages: + msg183051
2013-01-23 15:51:01sbtsetnosy: + sbt
2013-01-23 15:26:56jwilksetnosy: + jwilk
2013-01-23 15:15:21wodnycreate