It seems that the following line in /etc/init.d/rabbitmq-server script is the cause of the Popen hang<div><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
setsid sh -c "RABBITMQ_PID_FILE=$PID_FILE $DAEMON > \<br> ${INIT_LOG_DIR}/startup_log 2> ${INIT_LOG_DIR}/startup_err" &</blockquote><div><br></div><div>If I modify the script so it does not use setsid sh -c, the subprocess call does not hang anymore, but I expect side-effects if I do this.</div>
<div><br class="Apple-interchange-newline"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex"> RABBITMQ_PID_FILE=$PID_FILE $DAEMON > \<br>
${INIT_LOG_DIR}/startup_log 2> ${INIT_LOG_DIR}/startup_err &</blockquote></div>
<div><br></div><div>Any idea on how to fix it with my python Popen method ?</div><div><br></div><div class="gmail_quote">On Tue, Oct 16, 2012 at 2:15 PM, Raphaël De GIUSTI <span dir="ltr"><<a href="mailto:raphael.degiusti@guardis.com" target="_blank">raphael.degiusti@guardis.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Well, I have the same problem when subprocessing "/etc/init.d/rabbitmq-server start".<div><br></div><div>Note that I have no problem subprocessing "service rabbitmq-server status" or "service rabbitmq-server stop" (or any other service). </div>
<div><br></div><div>My only issue is with the start method of /etc/init.d/rabbitmq-server init script.<div><div><br><div><br></div><div><br><br><div class="gmail_quote">On Tue, Oct 16, 2012 at 1:34 PM, Tim Watson <span dir="ltr"><<a href="mailto:tim@rabbitmq.com" target="_blank">tim@rabbitmq.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">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?<br>
<div><div><br>
On 16 Oct 2012, at 11:47, Raphaël De GIUSTI wrote:<br>
<br>
> Hi everyone,<br>
><br>
> Starting the rabbitmq-server service with python's Popen from subprocess makes it hang.<br>
><br>
> Here's the little snippet to reproduce it (tested on Fedora 16 + Python2.7 and Centos 6.3 + Python2.6)<br>
><br>
> from subprocess import PIPE, Popen<br>
> proc = Popen('service rabbitmq-server start', shell=True, stderr=PIPE, stdout=PIPE)<br>
> print proc.communicate()<br>
><br>
> Problem is with "stdout=PIPE", I think.<br>
><br>
> The following snippet works, using proc.wait()<br>
><br>
> from subprocess import PIPE, Popen<br>
> proc = Popen('service rabbitmq-server start', shell=True, stderr=PIPE, stdout=PIPE)<br>
> print proc.wait()<br>
><br>
> Any idea on how to fix it using proc.communicate() because I need feedback from the "subprocess.PIPE" ?<br>
><br>
> Thank you.<br>
><br>
> Raphael<br>
</div></div>> _______________________________________________<br>
> rabbitmq-discuss mailing list<br>
> <a href="mailto:rabbitmq-discuss@lists.rabbitmq.com" target="_blank">rabbitmq-discuss@lists.rabbitmq.com</a><br>
> <a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss" target="_blank">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br>
<br>
_______________________________________________<br>
rabbitmq-discuss mailing list<br>
<a href="mailto:rabbitmq-discuss@lists.rabbitmq.com" target="_blank">rabbitmq-discuss@lists.rabbitmq.com</a><br>
<a href="https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss" target="_blank">https://lists.rabbitmq.com/cgi-bin/mailman/listinfo/rabbitmq-discuss</a><br>
</blockquote></div><br></div></div></div></div>
</blockquote></div><br></div>