Re: [PHP-DEV] zend_timeout and the SIGPROF signal

2003-02-20 Thread wmeler
 I have a question in regards to page timeouts and how the initial
 I've noticed if a query takes longer than the default 30 seconds to
 execute, php returns a timeout message to the user. From what I can
 tell, php uses the SIGPROF signal to stop execution when the 30 
 seconds
 has expired. Also, I've found that it doesn't seem to unwind the 
 stack

I've reported it as bug #16820 and submited a patch, but no one 
answered ...
I think it is better to use the same method as in Windows environment - 
set a EG(timeout) flag.

regards,
Wojtek


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] zend_timeout and the SIGPROF signal

2003-02-20 Thread wmeler
- Original Message -
 On timeout, the engine will call zend_bailout(), which performs a 
 longjmp().  It does unwind the stack, but since we're dealing with 
 C and 
 not C++ and there are no destructors, it's your responsibility to 
 clean 
 after yourself.  You can do it by properly registering your 
 resources with 
 PHP's infrastructure (using the Zend Engine memory management, 
 resource 
 management, etc.), which will be destroyed when the request 
 terminates (in 
 this case, shortly after the longjmp()).  Doing this is a good 
 idea 
 (read:  must) regardless of timeouts, it's the safety net that 
 ensures that 
 your code will not be leaking memory and/or resources beyond the 
 context of 
 a single request.
 
 Zeev

It is impossible to do it in ZTS for malloc - it uses internal lock 
which is not a PHP resource. Long jump from signal causes that lock to 
be not released and we have beautiful deadlock ...
Also when you use external library and it is modifying its internal 
structures when signal come, cleaning it is impossible (and dangerous).
ZE shouldn't use zend_bailout in signal!!!

regards,
Wojtek


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php




Re: [PHP-DEV] zend_timeout and the SIGPROF signal

2003-02-20 Thread wmeler
- Original Message -
 I looked into the bug report, and it is true that 
 BLOCK_INTERRUPTIONS 
 should indeed block SIGPROF.  I'll fix this in the weekend.

I'm not sure if after unblocking interruptions PHP will get SIGPROF ... 
it could cause long scripts. I'd rather use EG(timeout). I'm using 
it now and it's working.

regards,
Wojtek


-- 
PHP Development Mailing List http://www.php.net/
To unsubscribe, visit: http://www.php.net/unsub.php