Page 1 of 1

[SOLVED] Signal Blocking by the exec() command

Posted: Thu Aug 18, 2005 10:43 am
by Ray Glynn
Howdy Folks,

First time post so go easy!

Has anyone experienced signal blocking problems with the exec() command?

I'm testing exec() with the vmstat command on HP-UX unix. The same problem is occuring on Linux flavors (Red-hat and Suse) but I'm testing now on HP-UX.

If i run vmstat from the command line and follow it with a trace all works Ok. I pass it a SIGUSR1, it doesn't recognise it and bombs out.

Now if i call vmstat using the exec() function (i'm implementing a WebUI) and then pass it the SIGUSR1 from the command line, the signal never reaches the command, as outputted by the trace.

Why is this signal getting blocked? I've tried the same with the SIGALRM and that gets through.

Any ideas?

Many Thanks,

Ray

Posted: Mon Aug 22, 2005 5:53 am
by Ray Glynn
bump!

Posted: Mon Aug 22, 2005 6:32 am
by AnarKy
Ray Glynn wrote:bump!

:?: :?: :?: :?:

Did you sort the issue out?

Posted: Mon Aug 22, 2005 7:56 am
by Weirdan
exec(2) wrote: Signals set to the default action (SIG_DFL) in the calling
process image are set to the default action in the new pro-
cess image (see signal(3C)). Signals set to be ignored
(SIG_IGN) by the calling process image are set to be ignored
by the new process image.
Signals set to be caught by the
calling process image are set to the default action in the
new process image (see signal(3HEAD)). After a successful
call to any of the exec functions, alternate signal stacks
are not preserved and the SA_ONSTACK flag is cleared for all
signals.
perhaps php simply ignores SIGUSR1. I'm not quite sure, maybe setting SIGUSR1 to SIG_DFL in the new process may solve your issue.

Posted: Mon Aug 22, 2005 9:37 am
by Ray Glynn
Thanks Weirdan,

I'll take a look into that. The problem is still with me!

PHP seems to be blocking SIG_USR1 and letting SIG_ALRM through.

I'll post the solution if we sort it.

Ray.

SOLVED!

Posted: Mon Aug 22, 2005 10:19 am
by Ray Glynn
Thanks Weirdan,

I explicitly unblocked the SIG_USR1 in my called process and this has resolved the problem.

Ray.