Re: zend_timeout and the SIGPROF signal
| From: | wmeler at wp-sa dot pl | Date: | Thu, 20 Feb 2003 15:05:12 +0000 |
| Subject: | Re: zend_timeout and the SIGPROF signal | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-94394@lists.php.net to get a copy of this message | ||
----- 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