On Sun, 2001-10-14 at 23:59, Edouard Gomez wrote:
> > Alex wrote:
> > I'm assuming if you look in your log files if your link fails after 25
> > times you have a running pppoa2/3 (the original one) and all the
> > respawned ones failing because they couldn't get the usb interface.
> Yes, i think you're right. You should have one pppoa3 still running (1 
> process == 4 threads in Linux systems). I think pppd is buggy but i 
> didn't find where the problem is.
There are also several versions of pppd about (in various distro's) so I
guess we will have to be flexible to handle "broken" ones.
> > <snip>
> > pointers anyone? where is pppd developed?
> No pointers, I don't even know who maintains pppd !
I'll have to have a look around today.

> Btw, i think I've found a good solution to this problem. pppoa3 now uses a pid file.
> I told you I've implemented a --clean option to pppoa3. But as you
> suggested me (and as i thought) this solution introduced a racing 
> problem when cleaning the old pppoa3.

The one imediate problem I can think off is if you are running several
instances of pppd and pppoa for multiple modems. Does anyone actually do
that? It will mean people with that configuration may have to mess with
scripts instead.

> 
> My solution description :
> 
> 
> 1 - start
> 
> 2 - creates an IPC semaphore with  semget (and PC_CREAT|IPC_EXCL)
>      if the semaphore already exists, the semget returns -1 and
>      sets errno to EAGAIN so we know another instance has not cleanly
>      exited (or is still running).
> 
>     21 - if "--clean|-c" option has been specified then :
> 
>        210 - open the pidfile and read the previous instance pid
>        211 - kill the process group (the process and all threads)

How do we kill the old process? Catachable or non-catchable signal?

>        212 - grab the semaphore so this process is sleeping untill
>              the previous instance releases the semaphore
>        213 - destroy the semaphore (since we can't know the old
>              instance has already destroyed it)
>        213 - repeat the semaphore creation, but this time we are
>              sure to be able to create it because :
>                 - the old instance tried to delete it
>                 - this instance tried to delete it too

Why not keep creating the semaphore as in 2? Surely if the old pppoa
does't clean itself properly its a bug? I assume the IPC semaphore is
one the "outside" of the main code (before all the usb stuff)?

> 3 - Grab the semaphore
> 4 - create the pid file...(O_CREAT|O_TRUNC), writes the pid in it
> 5 - do normal job (threads read/write/pipe ...)
> 6 - unlink pid file
> 7 - release the semaphore
> 8 - destroy the semaphore
> 9 - exit
> 
>    I think the semaphore usage avoid the racing condition on the pid 
> file creation/destruction between both pppoa3 instances.
>    That's the cleanest solutin i've found, tell me if you have one which 
> is better.

I think that should do. If we ever find the proper place for pppd we
should supply a patch for that as well so -c can be marked as a "hackery
flag for poor pppd implemenatations :-)".

> Edouard Gomez
> 
> 
> NB : we can use the smallsem lib included in the driver package to implement this 
>solution.
Good, with static linking on my box I doen't want pppoa exceeding 2Mb!

Alex.


Liste de diffusion modem ALCATEL SpeedTouch USB
Pour se d�sinscrire : mailto:[EMAIL PROTECTED]?subject=unsubscribe

        

Reply via email to