supervision - discussion about system services, daemon supervision, init, runlevel management, and tools such as s6 and runit
 help / color / mirror / Atom feed
From: Dmitry Bogatov <KAction@debian.org>
To: supervision@list.skarnet.org
Cc: Gerrit Pape <pape@dbnbgs.smarden.org>,
	Lorenzo Puliti <lorenzo.ru.g@gmail.com>,
	916230@bugs.debian.org
Subject: Bug#916230: Svlogd: log files named as `timestamp.u' even if there is no processor in place
Date: Thu, 20 Dec 2018 18:02:52 +0000	[thread overview]
Message-ID: <E1ga2es-0002ds-Nb@eggs.gnu.org> (raw)
In-Reply-To: <20181219092106.7171.qmail@2a19f86b97c12b.315fe32.mid.smarden.org>


Hello, supervision list!

I am Debian maintainer of 'runit' package, and I ask for help with
issue, described at 'https://bugs.debian.org/916230'.

There is piece of code in svlogd.c, that causes strage behaviour, but it
looks it was introduced on puprose. If you know, could you please
explain this purpose to me?

[2018-12-19 09:21] Gerrit Pape <pape@dbnbgs.smarden.org>
> I'm sorry, can't give you any input, I'm busy with different things
> these days.  But there're people around knowing the runit programs and
> code, you can try to contact them through the mailing list
> <supervision@list.skarnet.org> .

Thank you for hint.

> On Mon, Dec 17, 2018 at 02:54:43PM +0000, Dmitry Bogatov wrote:
> > 
> > [2018-12-12 19:39] Dmitry Bogatov <KAction@debian.org>
> > > I managed to reproduce bug. Seems that .u file appears when svlogd is
> > > restarted and there is some .s files, but not always. I plan to debug
> > > it this weekend.
> > > 
> > > Thank you for report. If you have some ideas, how to reproduce bug
> > > more reliable, it would be great!
> > 
> > Offending .u file is created by rename(2) call at line 532, in
> > logdir_open() function. It happens, when 'current' file exists,
> > non-executable and non-empty.
> > 
> > Well, this is quite normal state of affairs. When `svlogd' is running,
> > `current' file is getting appended, when its size reaches `ld->sizemax'
> > (or something like this), it gets renames to @timestamp, and new
> > `current' is created.
> > 
> > So, if I interrupt `svlogd' at any time, but just after rotation, I
> > will get this leftover .u file. I am not perfectly sure, but seems that
> > `struct logdir` has `size' field, that means current size of log file.
> > 
> > I believe following patch would solve current issue. But wouldn't
> > it cause another problems? There must be reason, why this logic was
> > implemented. Gerrit, some input, please?
> > 
> > diff --git a/runit-2.1.2/src/svlogd.c b/runit-2.1.2/src/svlogd.c
> > index fab8441..3f8ead4 100644
> > --- a/runit-2.1.2/src/svlogd.c
> > +++ b/runit-2.1.2/src/svlogd.c
> > @@ -521,20 +521,7 @@ unsigned int logdir_open(struct logdir *ld, const char *fn) {
> >  
> >    /* open current */
> >    if ((i =stat("current", &st)) != -1) {
> > -    if (st.st_size && ! (st.st_mode & S_IXUSR)) {
> > -      ld->fnsave[25] ='.'; ld->fnsave[26] ='u'; ld->fnsave[27] =0;
> > -      do {
> > -        taia_now(&now);
> > -        fmt_taia(ld->fnsave, &now);
> > -        errno =0;
> > -      } while ((stat(ld->fnsave, &st) != -1) || (errno != error_noent));
> > -      while (rename("current", ld->fnsave) == -1)
> > -        pause2("unable to rename current", ld->name);
> > -      rmoldest(ld);
> > -      i =-1;
> > -    }
> > -    else
> > -      ld->size =st.st_size;
> > +    ld->size =st.st_size;
> >    }
> >    else
> >      if (errno != error_noent) {
> 


           reply	other threads:[~2018-12-20 18:02 UTC|newest]

Thread overview: expand[flat|nested]  mbox.gz  Atom feed
 [parent not found: <20181219092106.7171.qmail@2a19f86b97c12b.315fe32.mid.smarden.org>]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=E1ga2es-0002ds-Nb@eggs.gnu.org \
    --to=kaction@debian.org \
    --cc=916230@bugs.debian.org \
    --cc=lorenzo.ru.g@gmail.com \
    --cc=pape@dbnbgs.smarden.org \
    --cc=supervision@list.skarnet.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).