Re: having a problem with multilog not shutting down...

Peter Wolfenden <[email protected]> Tue, 29 Jan 2013 07:03:27 -0800
Newsgroups gmane.comp.djb.syslog
Message-ID <CAAMh7U87XV8TucqnTsOgYZmR4Fb4xxmar5xudtdfWxG+_PAgjw@mail.gmail.com>
--0015175cff162e296e04d46eb261
Content-Type: text/plain; charset=ISO-8859-1

Jeremy,

As far as testing the theory (which is simply an excerpt of the manpage, as
Andy points out), you can write a simple script to emit some complete lines
and then stop in the middle of a line (without rendering ^D, \n, \r).

I imagine multilog works this way because:

1) One of the design goals is to avoid losing any application data.
2) Most applications render their output in complete lines.

It may be that output buffering is causing your application to pause
mid-line, in which case you either have to modify your application to flush
its output, or use the -k option and accept that you're going to lose log
data sometimes.

Cheers,

    Peter

On Tue, Jan 29, 2013 at 1:09 AM, Jeremy Hansen <[email protected]> wrote:

> Thanks.  This works as far as making sure that multilog gets killed, but
> I'm curious about your statement regarding multilog waiting for a newline.
>  Is this a problem with the application or is there something I can do to
> test this theory and fix it?
>
> Thanks
> -jeremy
>
> On Jan 28, 2013, at 8:52 PM, Peter Wolfenden <[email protected]>
> wrote:
>
> > Hi Jeremy,
> >
> > The svc-stop.sh script appears to support a -k option, which is supposed
> kill the service if SIGTERM doesn't stop it:
> >
> >     https://github.com/bruceg/supervise-scripts/blob/master/svc-stop.sh
> >
> > This could help it a situation where multilog is stuck waiting for a
> newline.
> >
> > Cheers,
> >
> >     Peter
> >
> > On Mon, Jan 28, 2013 at 8:24 PM, Andy Bradford <
> [email protected]> wrote:
> > Thus said Jeremy Hansen on Mon, 28 Jan 2013 20:10:48 -0800:
> >
> > > Point is, svc -d doesn't bring it down either, so it's not the script.
> > > What will cause a process to not die using svc -d?
> >
> > Well, the process will receive SIGTERM, and the documentation (which you
> > can  find here:  http://cr.yp.to/daemontools/multilog.html  ) says  this
> > about SIGTERM:
> >
> >   If multilog receives a TERM signal,  it will read and process data
> >   until the next newline, and then  exit, leaving stdin at the first
> >   byte of data it has not processed.
> >
> > Andy
> >
> >
> >
> >
> > --
> > Peter Wolfenden
> > 650-801-7714
>
>


-- 
Peter Wolfenden
650-801-7714

--0015175cff162e296e04d46eb261
Content-Type: text/html; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable

Jeremy,<div><br></div><div>As far as testing the theory (which is simply an=
 excerpt of the manpage, as Andy points out), you can write a simple script=
 to emit some complete lines and then stop in the middle of a line (without=
 rendering ^D, \n, \r).<div>
<br></div><div>I imagine multilog works this way because:</div><div><br></d=
iv><div>1) One of the design goals is to avoid losing any application data.=
</div><div>2) Most applications render their output in complete lines.=A0</=
div>
<div><br></div><div>It may be that output buffering is causing your applica=
tion to pause mid-line, in which case you either have to modify your applic=
ation to flush its output, or use the -k option and accept that you&#39;re =
going to lose log data sometimes.</div>
<div><br></div><div>Cheers,</div><div><br></div><div>=A0 =A0 Peter<br><div>=
<br><div class=3D"gmail_quote">On Tue, Jan 29, 2013 at 1:09 AM, Jeremy Hans=
en <span dir=3D"ltr">&lt;<a href=3D"mailto:[email protected]" target=3D"_bl=
ank">[email protected]</a>&gt;</span> wrote:<br>
<blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1p=
x #ccc solid;padding-left:1ex">Thanks. =A0This works as far as making sure =
that multilog gets killed, but I&#39;m curious about your statement regardi=
ng multilog waiting for a newline. =A0Is this a problem with the applicatio=
n or is there something I can do to test this theory and fix it?<br>

<br>
Thanks<br>
<span class=3D"HOEnZb"><font color=3D"#888888">-jeremy<br>
</font></span><div class=3D"HOEnZb"><div class=3D"h5"><br>
On Jan 28, 2013, at 8:52 PM, Peter Wolfenden &lt;<a href=3D"mailto:pwolfend=
[email protected]">[email protected]</a>&gt; wrote:<br>
<br>
&gt; Hi Jeremy,<br>
&gt;<br>
&gt; The svc-stop.sh script appears to support a -k option, which is suppos=
ed kill the service if SIGTERM doesn&#39;t stop it:<br>
&gt;<br>
&gt; =A0 =A0 <a href=3D"https://github.com/bruceg/supervise-scripts/blob/ma=
ster/svc-stop.sh" target=3D"_blank">https://github.com/bruceg/supervise-scr=
ipts/blob/master/svc-stop.sh</a><br>
&gt;<br>
&gt; This could help it a situation where multilog is stuck waiting for a n=
ewline.<br>
&gt;<br>
&gt; Cheers,<br>
&gt;<br>
&gt; =A0 =A0 Peter<br>
&gt;<br>
&gt; On Mon, Jan 28, 2013 at 8:24 PM, Andy Bradford &lt;<a href=3D"mailto:a=
[email protected]">amb-sendok-1362025=
[email protected]</a>&gt; wrote:<br>
&gt; Thus said Jeremy Hansen on Mon, 28 Jan 2013 20:10:48 -0800:<br>
&gt;<br>
&gt; &gt; Point is, svc -d doesn&#39;t bring it down either, so it&#39;s no=
t the script.<br>
&gt; &gt; What will cause a process to not die using svc -d?<br>
&gt;<br>
&gt; Well, the process will receive SIGTERM, and the documentation (which y=
ou<br>
&gt; can =A0find here: =A0<a href=3D"http://cr.yp.to/daemontools/multilog.h=
tml" target=3D"_blank">http://cr.yp.to/daemontools/multilog.html</a> =A0) s=
ays =A0this<br>
&gt; about SIGTERM:<br>
&gt;<br>
&gt; =A0 If multilog receives a TERM signal, =A0it will read and process da=
ta<br>
&gt; =A0 until the next newline, and then =A0exit, leaving stdin at the fir=
st<br>
&gt; =A0 byte of data it has not processed.<br>
&gt;<br>
&gt; Andy<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; --<br>
&gt; Peter Wolfenden<br>
&gt; <a href=3D"tel:650-801-7714" value=3D"+16508017714">650-801-7714</a><b=
r>
<br>
</div></div></blockquote></div><br><br clear=3D"all"><div><br></div>-- <br>=
Peter Wolfenden<br>650-801-7714<br>
</div></div></div>

--0015175cff162e296e04d46eb261--