This is the mail archive of the libc-alpha@sources.redhat.com mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Thread exit leaves zombies ...................


"Manoj Nayak" <mnayak@in.ibm.com> writes:

> After sending signal to child threads & main thread ,manager thread
> dies .However main thread is not killed in response to manager
> thread's signal as it has already blocked that signal & at the same
> time main thread is not waiting ( in a waitpid() call ) for manager
> thread to free any system resource used by manager thread. That's
> why manager thread becomes zombie.
> 
> This is rectified by passing __pthread_sig_cancel as one of flags to
> clone () system call.

Your expectations are wrong.  And the test program, btw: you are not
allowed to use sigprocmask() in multi-threaded applications.

The Unix/POSIX standard says:

  When a signal is delivered to a thread, if the action of that signal
  specifies termination, stop, or continue, the entire process shall
  be terminated, stopped, or continued, respectively.

I.e., blocking signal 2 in one thread must not prevent the thread from
being killed if any other thread accepts the signal with the
termination action and gets such a signal delivered.

This does not mean the current implementation is correct.  It isn't.
But your patch isn't doing to right thing.  I see no possibility to
fix this in the moment.  The signal handling the kernel implements is
not sufficient.

-- 
---------------.                          ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Red Hat          `--' drepper at redhat.com   `------------------------


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]