pombreda / gevent

Automatically exported from code.google.com/p/gevent
0 stars 0 forks source link

gevent subprocess can fail to pipe output from one process to another #134

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1.
> touch logfile

2. run the attached script:
> python test_that_fails.py

3.
> echo 'text' >> logfile

What is the expected output? What do you see instead?
Expected output (this is what I see if I just use 'import subprocess' at the 
top of test_that_fails.py):
text

Actual output:
grep: (standard input): Resource temporarily unavailable
tail: write error: Broken pipe
tail: write error
tail returned error code 1
grep returned error code 2

What version of the gevent are you using?
gevent trunk @ r d0d32aec45d0

On what operating system?
Ubuntu 12.04 LTS

On what Python?
Python 2.7.3

Please provide any additional information below.
To be clear, test_that_fails.py fails every time for me. The reason I wrote in 
the description that it *can* fail is because if I run the attached 
test_that_works.py, then I get the expected output listed above.

Original issue reported on code.google.com by mrkhings...@gmail.com on 8 Jun 2012 at 6:37

Attachments:

GoogleCodeExporter commented 9 years ago
This issue was closed by revision 8c9722b1fc2a.

Original comment by Denis.Bi...@gmail.com on 10 Jul 2012 at 8:51

GoogleCodeExporter commented 9 years ago
The problem was that the standard descriptors in the child process ended up 
having O_NONBLOCK flag (gevent.fileobject.FileObject which gevent.subprocess 
uses sets this flag). The fix is to remove O_NONBLOCK flag from the relevant 
file descriptors.

https://bitbucket.org/denis/gevent/changeset/8c9722b1fc2a

test case https://bitbucket.org/denis/gevent/changeset/85bee9911814

Thanks for the report!

Original comment by Denis.Bi...@gmail.com on 10 Jul 2012 at 8:55

GoogleCodeExporter commented 9 years ago
Great! Thanks. It's working well for me now with the latest from the repo.

Thanks for the great lib :)

Original comment by mark.hin...@vardr.com on 11 Jul 2012 at 2:47

GoogleCodeExporter commented 9 years ago
Migrated to http://github.com/SiteSupport/gevent/issues/134

Original comment by Denis.Bi...@gmail.com on 14 Sep 2012 at 10:53