<< | Thread Index | >> ]    [ << | Date Index | >> ]

Subject: Re: Race condition on cipe startup
From: Roberto Nibali <ratz,AT,tac,DOT,ch>
Date: Mon, 31 Mar 2003 14:42:01 +0200
In-reply-to: <200303262002.57449.rsmckown@yahoo.com>

Hi,

> If the child exits very quickly, the parent can processes the SIGCHLD event 
> via its handler before it reaches execution of pause() in ciped.c line 949. 
> 
> The parent blocks in pause() forever because the child has already sent its 
> signal, and the child blocks forever as a defunct process waiting for its 
> parent to wait() upon it.

Makes a lot of sense.

> We may see this when others haven't because we start multiple cipe tunnels 
> simultaneously.  Each ciped-cb allocates its device name dynamically, and 
>we 

I've seen this too occasionally, especially when we have boxes with more then 
100 cipe tunnels but I simply didn't have enough time to track it down.

> --- cipe-1.5.4/cipe/ciped.c.orig      2001-02-11 14:42:39.000000000 -0700
> +++ cipe-1.5.4/cipe/ciped.c   2003-03-26 15:24:17.000000000 -0700
> @@ -946,10 +946,8 @@
>       if (i) {
>              /* wait until the child is ready - will send SIGUSR1 */
>              while (1) {
> -                pause();
> -                if (gotsig==SIGCHLD) {
> -                    int s;
> -                    wait(&s);
> +             int s;
> +             if (wait(&s)==i) {
>                      exit(WIFEXITED(s)?WEXITSTATUS(s):255);
>                  }
>              }

Thanks a lot for this patch.

Best regards,
Roberto Nibali, ratz
-- 
echo '[q]sa[ln0=aln256%Pln256/snlbx]sb3135071790101768542287578439snlbxq' | dc





<< | Thread Index | >> ]    [ << | Date Index | >> ]