Re: Considering segfaults: how to protect other requests?
| From: | Rasmus Lerdorf | Date: | Sat, 21 Jan 2012 18:27:15 +0000 |
| Subject: | Re: Considering segfaults: how to protect other requests? | ||
| References: | 1 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-9055@lists.php.net to get a copy of this message | ||
On 01/21/2012 10:16 AM, Kārlis Repsons wrote:
> Hi there...
>
> Hopefully I've chosen a good place to start with a problem like this:
> using apache2 prefork, I've confirmed that the same PHP extension can
> receive multiple requests through browser and if one of those requests
> causes a segfault, the other request, which is still in process during
> the segfault, will be completed. Good... But how to be sure if this is
> just a particular case or there is some way to know that ONLY those
> requests will get terminated, which are themselves causing a segfault?
> Or make it that way?
>
> What should I read to understand (sufficiently well) what is going on
> inside of Apache and PHP to be sure of questions like this? I know short
> is in a conflict with complete or even sufficient, but anyway... Have to
> get started. Your advices are welcome!
One of the big benefits of not relying on a multi-threaded architecture
is that each preforked httpd (or php-fpm) process has its own separate
memory space managed by the kernel. In an MT architecture you have to do
your own memory management. I much prefer letting the kernel keep me
safe. So yes, if something corrupts memory and an httpd process
segfaults, there is no bleed-over into other httpd processes. This is an
architectural feature, not a fluke.
-Rasmus