Stefan Monnier writes: >> In fact, there is already a configuration that would lead to the non >> deletion of the PID from the list: > >> - Call to delete_process, >> - Interrupted by a signal before inserting in deleted_processes_list , >> - Deletion from process_alist, > > How can this happen? Are you saying that a signal handler may delete the > process from process_alist? Which signal handler can do that? You're right, it's not its job. > I do think there's a leak but it goes like this: > > - catch the SIGCHLD signal > - start processing delete-process, which will add the PID to > deleted_pid_list even though the signal has already been caught so the pid > won't get a chance to be removed. > I guess we could check the process's status after adding it to > deleted_pid_list, to catch this case. I think it would be OK. Here's the new (new new) version of the patch. The kill_process part is not called if the process is already terminated.