Issue2488

classification
Title: Subprocess should always join corresponding coupler threads
Type: behaviour Severity: normal
Components: Library Versions: Jython 2.7
Milestone: Jython 2.7.1
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: zyasoft Nosy List: cwicklow, zyasoft
Priority: Keywords:

Created on 2016-03-18.17:23:50 by cwicklow, last changed 2016-09-06.00:19:03 by zyasoft.

Messages
msg10824 (view) Author: Carl Wicklow (cwicklow) Date: 2016-03-18.17:31:40
In subprocess.py ...

If a caller is using poll(), and the poll() sets returncode != None, then a subsequent call to wait() will never join the coupler threads.

In the case that the executing process is redirecting output to files (particularly if the process is expected to generate large amounts of output), the coupler threads may not yet be complete. But a call to wait will not attempt to join the coupler threads (since the prior call to poll may have already stored the returncode), even if they are still purging I/O.

At that point, the caller cannot be certain that the output buffers are flushed (i.e. wait returns, giving the impression that the process is complete, but the I/O may still be being flushed), and has no way to know what that is complete (because wait will not block on the coupler threads if a prior call to poll has already determined that the process is complete).

A minor change in whitespace seems to resolve it (see https://github.com/jythontools/jython/pull/37).
msg10826 (view) Author: Jim Baker (zyasoft) Date: 2016-03-18.22:26:34
Looks like a simple oversight on our part. The Travis CI failure is unrelated.
msg10913 (view) Author: Jim Baker (zyasoft) Date: 2016-08-24.23:06:49
Fixed as of https://hg.python.org/jython/rev/35fa19ca1859
History
Date User Action Args
2016-09-06 00:19:03zyasoftsetstatus: pending -> closed
2016-08-24 23:06:49zyasoftsetstatus: open -> pending
resolution: accepted -> fixed
messages: + msg10913
title: Should subprocess wait always join any coupler threads ? -> Subprocess should always join corresponding coupler threads
2016-03-18 22:26:46zyasoftsetresolution: accepted
2016-03-18 22:26:41zyasoftsetassignee: zyasoft
2016-03-18 22:26:34zyasoftsetnosy: + zyasoft
messages: + msg10826
milestone: Jython 2.7.2 -> Jython 2.7.1
2016-03-18 17:31:41cwicklowsetmessages: + msg10824
2016-03-18 17:23:51cwicklowcreate