You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modules-dev@httpd.apache.org by Ben Rockefeller <be...@gmail.com> on 2012/02/28 22:05:49 UTC

Threads and signals in a module

Hello,

I have a module which creates a thread using pthread_create and then
registers for SIGRTMIN+4 signal from another process. Problem is I do not
see a signal callback when the signal is sent to me. I only see it when I
try to kill apache where just before dying it hits the signal callback.

So something in Apache is blocking the signal. I am using worker MPM.
What could be the issue. I do not have much leeway into changing the design
of the module (the threading model comes from a separate lib which I link
into the module)...but I can change to use a different signal than
SIGRTMIN+4, etc.
I can also change apache and recompile apache if needed.

Please let me know if you have any suggestions. I have been stuck at this
for a while now :-(

Thanks

Re: Threads and signals in a module

Posted by Sorin Manolache <so...@gmail.com>.
On 2012-02-28 22:05, Ben Rockefeller wrote:
> Hello,
>
> I have a module which creates a thread using pthread_create and then
> registers for SIGRTMIN+4 signal from another process. Problem is I do not
> see a signal callback when the signal is sent to me. I only see it when I
> try to kill apache where just before dying it hits the signal callback.
>
> So something in Apache is blocking the signal. I am using worker MPM.
> What could be the issue. I do not have much leeway into changing the design
> of the module (the threading model comes from a separate lib which I link
> into the module)...but I can change to use a different signal than
> SIGRTMIN+4, etc.
> I can also change apache and recompile apache if needed.
>
> Please let me know if you have any suggestions. I have been stuck at this
> for a while now :-(
>
> Thanks
>

In which hook do you create your thread and you register your signal 
handler?

Right after executing the child_init callbacks, apache blocks the 
threads from receiving most signals.

Check the list of blocked/ignored/caught signals using "ps axs" in a shell.

Sorin