The following reply was made to PR user/6509; it has been noted by GNATS.

From: Reyk Floeter <r...@openbsd.org>
To: Stuart Henderson <s...@spacehopper.org>
Cc: gn...@openbsd.org, Jonathan Gray <j...@goblin.cx>,
        Reyk Floeter <r...@openbsd.org>
Subject: Re: user/6509: relayctl show sessions make relayd crash
Date: Thu, 19 May 2011 12:33:10 +0200

 I still get the problem with your diff applied on -current.
 
 fatal: wrong message for session
 hce exiting, pid 28577
 lost child: pfe exited abnormally
 lost child: hce exited okay
 relay exiting, pid 12860
 relay exiting, pid 17479
 relay exiting, pid 15617
 relay exiting, pid 4932
 relay exiting, pid 11902
 parent terminating, pid 30803
 
 I accelerated the test a little bit by running two fast loops at the
 same time.  It seems that it happens less often with the diff but it
 is still there.
 
 # relayd -dvvf relayd-make-me-crash.conf
 $ while true; do relayctl show sessions; done
 $ while true; do relayctl show sessions; done
 
 I'm thinking about another solution to make it fully async.  I
 generally dislike this while(!done) loop in show_sessions() which is
 causing all kinds of difficulties.  I try to come up with a diff.
 
 reyk
 
 On Wed, May 18, 2011 at 03:30:58PM +0100, Stuart Henderson wrote:
 > jsg@ wrote on 2010-11-18:
 > > The problem is we have multiple handlers and get
 > > IMSG_STATISTICS when in the secondary handler.
 > > 
 > > Try the following diff from reyk:
 > 
 > This still occurs with up-to-date relayd; here is an updated
 > version of this diff (applies on top of the current reload diff)a
 > which fixes the problem for me.
 > 
 > Index: relay.c
 > ===================================================================
 > RCS file: /cvs/src/usr.sbin/relayd/relay.c,v
 > retrieving revision 1.136
 > diff -u -p -r1.136 relay.c
 > --- relay.c  9 May 2011 12:08:47 -0000       1.136
 > +++ relay.c  18 May 2011 14:26:45 -0000
 > @@ -450,10 +450,12 @@ relay_statistics(int fd, short events, v
 >              if (resetday)
 >                      cur->last_day = 0;
 >  
 > -            crs.id = rlay->rl_conf.id;
 > -            crs.proc = proc_id;
 > -            proc_compose_imsg(env->sc_ps, PROC_PFE, -1, IMSG_STATISTICS, -1,
 > -                &crs, sizeof(crs));
 > +            if (!env->sc_statstop) {
 > +                    crs.id = rlay->rl_conf.id;
 > +                    crs.proc = proc_id;
 > +                    proc_compose_imsg(env->sc_ps, PROC_PFE, -1,
 > +                        IMSG_STATISTICS, -1, &crs, sizeof(crs));
 > +            }
 >  
 >              for (con = SPLAY_ROOT(&rlay->rl_sessions);
 >                  con != NULL; con = next_con) {
 > @@ -2489,6 +2491,7 @@ relay_dispatch_pfe(int fd, struct privse
 >              evtimer_add(&con->se_ev, &tv);
 >              break;
 >      case IMSG_CTL_SESSION:
 > +            env->sc_statstop = 1;
 >              TAILQ_FOREACH(rlay, env->sc_relays, rl_entry) {
 >                      SPLAY_FOREACH(con, session_tree,
 >                          &rlay->rl_sessions) {
 > @@ -2499,6 +2502,7 @@ relay_dispatch_pfe(int fd, struct privse
 >              }
 >              proc_compose_imsg(env->sc_ps, p->p_id, -1, IMSG_CTL_END,
 >                  -1, NULL, 0);
 > +            env->sc_statstop = 0;
 >              break;
 >      default:
 >              return (-1);
 > Index: relayd.h
 > ===================================================================
 > RCS file: /cvs/src/usr.sbin/relayd/relayd.h,v
 > retrieving revision 1.146
 > diff -u -p -r1.146 relayd.h
 > --- relayd.h 9 May 2011 12:08:47 -0000       1.146
 > +++ relayd.h 18 May 2011 14:26:45 -0000
 > @@ -829,6 +829,7 @@ struct relayd {
 >  
 >      struct event             sc_statev;
 >      struct timeval           sc_statinterval;
 > +    int                      sc_statstop;
 >  
 >      int                      sc_snmp;
 >      struct event             sc_snmpto;

Reply via email to