php 4.3.3 / pcntl_signal problem?

From: Date: Mon, 06 Oct 2003 17:36:09 +0000
Subject: php 4.3.3 / pcntl_signal problem?
Groups: php.general 
Request: Send a blank email to php-general+get-165211@lists.php.net to get a copy of this message
Hi All, [This is quite a long post, my apologies :(] I have the CLI version of PHP 4.3.3 running under FreeBSD 5.1-Release. I seem to have encountered some 'strange' behaviour with signals... I may have missed the plot so far as signals go under PHP, but from within my signal handler routine - I appear to only be able to call '1 level' of user functions, i.e. If I call a user function, which in turn calls another user-function, my signal handler appears never gets returned to. e.g. function my_sig_handler( $signo ){ if( $signo == SIGTERM ){ echo( "Term received, cleaning up...\n" ); do_cleanup(); echo( "Clean up done.\n" ); exit(); } } Appears to work, but _IF_ "do_cleanup()" in turn calls another routine, e.g. function do_cleanup(){ echo( "Cleaning up...\n" ); write_my_log_entry( "Cleaning up" ); echo( "Clean up is now complete.\n" ); } All I see on the output is: " Term received, cleaning up... Cleaning up... [log entry written] devbox> " If I comment out the "write_my_log_entry" function in do_cleanup() - I get: " Term received, cleaning up... Cleaning up... Done cleaning up Clean up is now complete. devbox> " Which is what I'd expect. I have thoroughly checked "write_my_log_entry()" - and even if I just change that to a simple "echo" routine [i.e. no actual code] - if it's called from the signal handler, as a function being called by a function - the signal handler never see's the light of day once write_my_log_entry() has finished. I can kind of work around this, by in-lining the code from the actual functions - but I'd rather not (for obvious reasons). Anyone else out there done a lot of work with PHP signals who might be able to shed some light on this? Thanks in advance, -Karl

« previous php.general (#165211) next »