Re: Considering segfaults: how to protect other requests?
| From: | Ferenc Kovacs | Date: | Sat, 21 Jan 2012 21:23:13 +0000 |
| Subject: | Re: Considering segfaults: how to protect other requests? | ||
| References: | 1 2 3 4 | Groups: | php.pecl.dev |
| Request: | Send a blank email to pecl-dev+get-9060@lists.php.net to get a copy of this message | ||
>
>
>>> 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
> 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<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).
how?
the segfault would terminate the worker, and even overwriting stuff would
overwrite it for that worker, you can't directly overwrite the apache
control process.
am I missing something?
>
>
>
> 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
> (program
> inside which php runs). I would recommend you to begin developing to php
> cli.
> It's much easier to run, debug and reload.
>
>
for debuging segfaults in web apps, usually it is easier to take a core
dump, and step over the execution using gdb:
https://bugs.php.net/bugs-generating-backtrace.php
but you can also limit the worker limit to 1, and gdb into that sole worker
and push a reload in your browser to trigger the segfault.
--
Ferenc Kovács
@Tyr43l - http://tyrael.hu