Login | Register For Free | Help
Search for: (Advanced)

Mailing List Archive: Python: Python

Subprocess troubles from a daemon

 

 

Python python RSS feed   Index | Next | Previous | View Threaded


Eirikur.Hjartarson at decode

Apr 13, 2012, 4:04 AM

Post #1 of 3 (111 views)
Permalink
Subprocess troubles from a daemon

Hi,

I think I have possibly found a bug in the subprocess module. The (potential) bug appears when executing a subprocess from a daemon (after double-forking). This is on RHEL 6.2 with python version 2.6.6.

The problem can be demonstrated with the two attached files, both files should be made executable and then run './example'. There is output both on stdout and in the file: '/tmp/example.log'.

The 'service' program writes on both stdout and stderr, sleeps 10 seconds and exits.

The 'exemple' program executes the subprocess, 'service', (to demonstrate that the subprocess module works), then double-forks, closes file-desciptors, points sys.stdout and sys.stderr to a logfile and executes the 'service' subprocess again. The second execution fails when the subprocess references sys.stderr. If the ' print >>sys.stderr, ...' line is commented out of the 'service' file, the second execution succeeds. The first call to subprocess.Popen produces output on stdout, the second call outputs to '/tmp/example.log'. On the other hand, if the lines in 'service' that are commented out (write on '/tmp/service.out') are enabled, the stderr output appears in that file.

If I use 'os.popen3' instead of ' subprocess.Popen', the problem disappears.

I would love to hear your opinions on this :-)

Regards,
--
Eiríkur Hjartarson
deCODE genetics
Sturlugötu 7
IS-101 Reykjavík
Attachments: example (2.45 KB)
  service (0.35 KB)


tjreedy at udel

Apr 13, 2012, 7:57 AM

Post #2 of 3 (107 views)
Permalink
Re: Subprocess troubles from a daemon [In reply to]

On 4/13/2012 7:04 AM, Eiríkur Hjartarson wrote:
> Hi,
>
> I think I have possibly found a bug in the subprocess module. The
> (potential) bug appears when executing a subprocess from a daemon
> (after double-forking). This is on RHEL 6.2 with python version
> 2.6.6.

What happens is you use the new 2.7.3 release? It has hundreds of bug
fixes not in 2.6.x.

--
Terry Jan Reedy


--
http://mail.python.org/mailman/listinfo/python-list


Eirikur.Hjartarson at decode

Apr 13, 2012, 8:26 AM

Post #3 of 3 (107 views)
Permalink
RE: Subprocess troubles from a daemon [In reply to]

Hi,

> -----Original Message-----
> From: python-list-bounces+eirikur.hjartarson=decode.is [at] python
> [mailto:python-list-bounces+eirikur.hjartarson=decode.is [at] python] On
> Behalf Of Terry Reedy
> Sent: 13. apríl 2012 14:57
> To: python-list [at] python
> Subject: Re: Subprocess troubles from a daemon
>
> On 4/13/2012 7:04 AM, Eiríkur Hjartarson wrote:
> > Hi,
> >
> > I think I have possibly found a bug in the subprocess module. The
> > (potential) bug appears when executing a subprocess from a daemon
> > (after double-forking). This is on RHEL 6.2 with python version
> > 2.6.6.
>
> What happens is you use the new 2.7.3 release? It has hundreds of bug
> fixes not in 2.6.x.

I don't have access to 2.7.3-python, but I tried it on 2.7.2, and there the bug is fixed.

> --
> Terry Jan Reedy

Thanks,
--
Eiríkur Hjartarson
deCODE genetics
Sturlugötu 7
IS-101 Reykjavík
--
http://mail.python.org/mailman/listinfo/python-list

Python python RSS feed   Index | Next | Previous | View Threaded
 
 


Interested in having your list archived? Contact Gossamer Threads
 
  Web Applications & Managed Hosting Powered by Gossamer Threads Inc.