Re: Considering segfaults: how to protect other requests?
| From: | Ángel González | Date: | Sat, 21 Jan 2012 21:18:06 +0000 |
| Subject: | Re: Considering segfaults: how to protect other requests? | ||
| References: | 1 2 3 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-9058@lists.php.net to get a copy of this message | ||
On 21/01/12 21:27, Kārlis Repsons wrote:
On 01/21/2012 08:27 PM, Rasmus Lerdorf wrote:to write to a random pointer. A segfault is nice, as it clearly shows a failure, but the same pointer error could potentially overwrite something that is kept through several requests, and corrupt something on a subsequent request (check |MaxRequestsPerChild <http://httpd.apache.org/docs/2.0/es/mod/mpm_common.html#maxrequestsperchild>| directive), or maybe show no failure at all (despite of the bug).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.Does just running Apache with prefork MPM warrants that each request for a functionality of the same PHP extension will be isolated from all other requests? Note however that a segfault is the result of a programming error, such as trying
What should I read about Apache and PHP first to do extension development? Currently I'm just having some C/C++ examples and Apache is a black box to me... Apache isn't really required to do php development. It's just another sapi (programinside which php runs). I would recommend you to begin developing to php cli. It's much easier to run, debug and reload.