emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: delete-process bug


From: Michaël Cadilhac
Subject: Re: delete-process bug
Date: Sat, 27 May 2006 11:19:58 +0200
User-agent: Gnus/5.110006 (No Gnus v0.6) Emacs/22.0.50 (gnu/linux)

Michael Mauger <address@hidden> writes:

> Stefan Monnier <monnier <at> iro.umontreal.ca> writes:
>
>> 
>> > Thanks for working on this.  I agree that `live_deleted_processes'
>> > is a good name.  ("Zombie process" has a different meaning.)
>> 
>> > However, maybe there is still a race condition.  Suppose the signal
>> > comes in the middle of the line
>> 
>> >     +      live_deleted_processes = Fcons (make_number (p->pid),
>> >     +                                    /* GC previous elements.  */
>> >     +                                    Fdelq (Qnil, 
> live_deleted_processes));
>> 
>> > Suppose it comes between there and the call to remove_process?
>> 
>> I think it's OK: if the signal handler comes before the assignment to
>> live_deleted_processes, then it'll all behave as if the signal came even
>> before the call to delete-process.  If it comes afterwards, the signal will
>> be ignored (as if it came after the call to delete-process).
>> 
>> > Does the right thing happen in all these cases?
>> 
>> I believe so.
>> 
>
> My instinct would be to add the pid to the list prior to causing the event 
> that 
> the list is designed to detect.  Treating the signal as though it happened 
> before the call to delete-process (if we don't add the pid to the list first) 
> when we know it was most likely caused by delete-process seems to be asking 
> for 
> trouble.

Sounds better, indeed.

However, no race condition could have happened because of a (more)
simple thing (than what I said):

The race condition appears when
1) Emacs got a SIGCHLD
2) and the process has been suppressed from process_list.

But the deletion from process_list is made _after_ the adding to
live_deleted_processes. So no problem here, I think, the process is
always known (so not supposed to be a synchronous one).

If something has to be put in comment to say that no race condition
is triggered, I think something like the following is OK:

``A race condition occurred when the deleted process was no longer in
process_list but still had a SIGCHLD treatment to do. Now, the deleted
process is never thought to be asynchronous.''

Regards

-- 
 |      Michaël `Micha' Cadilhac   |     Le copillage-collage               |
 |         Epita/LRDE Promo 2007   |        tue le programmeur.             |
 | http://www.lrde.org/~cadilh_m   |            -- Dictons LRDE             |
 `--  -   JID: address@hidden --'                                   -  --'

Attachment: pgp7xF6akAKFY.pgp
Description: PGP signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]