[rabbitmq-discuss] "service rabbitmq-server start" hangs when using python's Popen from subprocess.

Raphaël De GIUSTI raphael.degiusti at guardis.com
Tue Oct 16 13:15:05 BST 2012


Well, I have the same problem when subprocessing
"/etc/init.d/rabbitmq-server start".

Note that I have no problem subprocessing "service rabbitmq-server status"
or "service rabbitmq-server stop" (or any other service).

My only issue is with the start method of /etc/init.d/rabbitmq-server init
script.



On Tue, Oct 16, 2012 at 1:34 PM, Tim Watson <tim at rabbitmq.com> wrote:

> When you run RabbitMQ on an rpm based distro using /sbin/service then the
> init script is going to redirect stdio, as you would expect for a
> service/daemon. You'll need to start RabbitMQ directly from the
> ./scripts/rabbitmq-server shell script I guess, if you want to grab stdio -
> or tail the logs?
>
> On 16 Oct 2012, at 11:47, Raphaël De GIUSTI wrote:
>
> > Hi everyone,
> >
> > Starting the rabbitmq-server service with python's Popen from subprocess
> makes it hang.
> >
> > Here's the little snippet to reproduce it (tested on Fedora 16 +
> Python2.7 and Centos 6.3 + Python2.6)
> >
> > from subprocess import PIPE, Popen
> > proc = Popen('service rabbitmq-server start', shell=True, stderr=PIPE,
> stdout=PIPE)
> > print proc.communicate()
> >
> > Problem is with "stdout=PIPE", I think.
> >
> > The following snippet works, using proc.wait()
> >
> > from subprocess import PIPE, Popen
> > proc = Popen('service rabbitmq-server start', shell=True, stderr=PIPE,
> stdout=PIPE)
> > print proc.wait()
> >
> > Any idea on how to fix it using proc.communicate() because I need
> feedback from the "subprocess.PIPE" ?
> >
> > Thank you.
> >
> > Raphael
> > _______________________________________________
> > rabbitmq-discuss mailing list
> > rabbitmq-discuss at lists.rabbitmq.com
> > https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>
> _______________________________________________
> rabbitmq-discuss mailing list
> rabbitmq-discuss at lists.rabbitmq.com
> https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rabbitmq.com/pipermail/rabbitmq-discuss/attachments/20121016/9bfe378f/attachment.htm>


More information about the rabbitmq-discuss mailing list