[systemd-devel] [PATCH 1/4] manager: print a warning after 2/3 of the start timeout

Zbigniew Jędrzejewski-Szmek zbyszek at in.waw.pl
Mon Oct 27 12:07:08 PDT 2014


On Mon, Oct 27, 2014 at 06:49:22PM +0100, Lennart Poettering wrote:
> > +                log_info("Active jobs (%u running):\n\t%s.", m->n_running_jobs, all);
> > +        } else
> > +                log_info("No jobs seem to be running.");
> > +
> > +        return 0;
> > +}
> 
> A long-standing TODO list item has been to print something like this
> if the user hits C-A-Del 3 times within 1s or so (under the assumption
> that he might do this if shutdown gets stuck for some reason). If we have
> this function in place, maybe that's something to quickly hookup with
> C-A-Del too? (using the ratelimit infrastruturce should make the patch
> for detecting the 3-times-within-1s thing trivial)...
I'd prefer to reserve c-a-del×3 for reboot-force now. Maybe we
could use ^C for status instead? Or even simply 's'? As long as
we haven't launched anything using the tty, we could interpret the
keystrokes.

> >  static int manager_watch_jobs_in_progress(Manager *m) {
> >          usec_t next;
> >  
> > @@ -1015,15 +1054,39 @@ static int manager_distribute_fds(Manager *m, FDSet *fds) {
> >  
> >  static int on_start_timeout(sd_event_source *s, usec_t usec, void *userdata) {
> >          Manager *m = userdata;
> > +        int r;
> >  
> >          assert(s);
> >          assert(m);
> >  
> > +        if (!m->start_timeout_warned) {
> > +                log_warning("2/3 of the start timeout have passed.");
> > +                m->start_timeout_warned = true;
> > +
> > +                (void) manager_log_running_jobs(m);
> > +
> > +                r = sd_event_source_set_time(m->start_timeout_event_source,
> > +                                             now(CLOCK_MONOTONIC) +
> > m->start_timeout_usec / 3);
> 
> I think it would be nicer to use the original startup timestamp for
> this, instead of invoking now() here again...
> 
> In fact, I think I should have used m->userspace_timestamp.monotonic
> as base for this in the first place....
OK.

Zbyszek


More information about the systemd-devel mailing list