Issue1508

classification
Title: Subprocess with stdout throws Exception
Type: behaviour Severity: normal
Components: Library Versions: Jython 2.5
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: pjenvey Nosy List: Bruce, fwierzbicki, gsnedders, pjenvey, seanogie, zyasoft
Priority: low Keywords:

Created on 2009-11-26.18:05:01 by gsnedders, last changed 2014-06-19.19:20:18 by zyasoft.

Files
File name Uploaded Description Edit Remove
foo gsnedders, 2009-11-26.18:05:00 Testcase
Messages
msg5325 (view) Author: (gsnedders) Date: 2009-11-26.18:05:00
Running the attached file in Jython 2.5.1 causes the following to be 
thrown:

Exception in thread "_CouplerThread-1 (stdout)" Traceback (most recent 
call last):
  File "/usr/local/jython-2.5.1/Lib/subprocess.py", line 679, in run
    self.write_func(buf)
  File "/usr/local/jython-2.5.1/Lib/subprocess.py", line 679, in run
    self.write_func(buf)
ValueError: I/O operation on closed file
msg5326 (view) Author: Philip Jenvey (pjenvey) Date: 2009-11-28.20:42:05
I can't reproduce this on OS X. What platform are you running on?
msg5336 (view) Author: (gsnedders) Date: 2009-12-01.13:38:12
GNU/Linux x86, specifically Ubuntu 9.10.

Also, FWIW: $ java -version
java version "1.6.0_0"
OpenJDK Runtime Environment (IcedTea6 1.6.1) (6b16-1.6.1-3ubuntu1)
OpenJDK Client VM (build 14.0-b16, mixed mode)
msg5338 (view) Author: Philip Jenvey (pjenvey) Date: 2009-12-03.01:36:27
I can't reproduce this on the Linux boxes I have access to, one running 
Sun Java x86_64, the other running OpenJDK x86

I don't see how this error could be triggered by this piece of code, 
that ValueError is only raised when calling a method on a closed Python 
file object. The subprocess module doesn't call close() on the files 
passed into it.

The stack trace is also odd, it suggests that write_func somehow ended 
up calling itself, which doesn't make any sense

Am I missing something here?
msg7359 (view) Author: Chih-Jung Chen (Bruce) Date: 2012-08-09.08:22:23
I get this exception in Win XP.

Exception in thread "_CouplerThread-2 (stdout)" Traceback (most recent call last):
  File "C:\jython2.7a2\Lib\subprocess.py", line 754, in run
    self.write_func(buf)
  File "C:\jython2.7a2\Lib\subprocess.py", line 754, in run
    self.write_func(buf)
ValueError: I/O operation on closed file
msg7475 (view) Author: Sean (seanogie) Date: 2012-10-12.10:56:51
I also get the below error using Robotframework on Linux and Windows.

Exception in thread "_CouplerThread-5 (stdout)" Traceback (most recent call last):
  File "/home/seanog.oconaire/jython2.5.2/Lib/subprocess.py", line 675, in run
    self.write_func(buf)
  File "/home/seanog.oconaire/jython2.5.2/Lib/subprocess.py", line 675, in run
    self.write_func(buf)
ValueError: I/O operation on closed file
msg8737 (view) Author: Jim Baker (zyasoft) Date: 2014-06-19.07:34:28
I cannot reproduce this issue on Windows 8.1, OS X 10.9, or Ubuntu 13.10, all running JDK 7.

Earlier JDKs had problems with process management, as we have seen in other reported bugs. This may be the case here.
msg8759 (view) Author: (gsnedders) Date: 2014-06-19.17:11:38
I can still reproduce with Jython 2.5.3 on JDK7, can't reproduce with current tip.
msg8765 (view) Author: Jim Baker (zyasoft) Date: 2014-06-19.17:57:36
Thanks, this does gives us a bit more insight. What OS version were you running this test case on?
msg8767 (view) Author: (gsnedders) Date: 2014-06-19.18:06:30
This is on, unlike the above, Archlinux on x86_64, with the current Java package and the packaged Jython, which claims to be:

gsnedders@vanveen:~$ uname -a
Linux vanveen 3.14.6-1-ARCH #1 SMP PREEMPT Sun Jun 8 10:08:38 CEST 2014 x86_64 GNU/Linux
gsnedders@vanveen:~$ java -version
java version "1.7.0_60"
OpenJDK Runtime Environment (IcedTea 2.5.0) (Arch Linux build 7.u60_2.5.0-2-x86_64)
OpenJDK 64-Bit Server VM (build 24.60-b09, mixed mode)
gsnedders@vanveen:~$ /usr/bin/jython --version
Jython 2.5.3
msg8769 (view) Author: Jim Baker (zyasoft) Date: 2014-06-19.19:20:18
Everything is current then with what gsnedders just reported, so no blaming old versions ;), except our own implementation of subprocess
History
Date User Action Args
2014-06-19 19:20:18zyasoftsetmessages: + msg8769
2014-06-19 18:06:30gsnedderssetmessages: + msg8767
2014-06-19 17:57:36zyasoftsetmessages: + msg8765
2014-06-19 17:11:38gsnedderssetmessages: + msg8759
2014-06-19 07:34:29zyasoftsetnosy: + zyasoft
messages: + msg8737
2013-02-25 19:15:55fwierzbickisetversions: + Jython 2.5, - 2.5.2
2012-10-12 10:56:51seanogiesetnosy: + seanogie
messages: + msg7475
versions: + 2.5.2, - 2.7a2
2012-08-10 17:48:04fwierzbickisetnosy: + fwierzbicki
2012-08-09 08:22:24Brucesetnosy: + Bruce
messages: + msg7359
versions: + 2.7a2, - 2.5.1
2009-12-03 01:36:29pjenveysetpriority: low
messages: + msg5338
2009-12-01 13:38:13gsnedderssetmessages: + msg5336
2009-11-28 20:42:06pjenveysetmessages: + msg5326
2009-11-26 20:36:58pjenveysetassignee: pjenvey
nosy: + pjenvey
2009-11-26 18:05:01gsnedderscreate