RE: [PHP-DEV] threadsafe php crashes too easily
| From: | Anatol Belski | Date: | Fri, 26 Jan 2018 12:32:41 +0000 |
| Subject: | RE: [PHP-DEV] threadsafe php crashes too easily | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-101692@lists.php.net to get a copy of this message | ||
Hi,
> -----Original Message-----
> From: Hajo Locke [mailto:Hajo.Locke@gmx.de]
> Sent: Friday, January 26, 2018 12:43 PM
> To: internals@lists.php.net
> Subject: [PHP-DEV] threadsafe php crashes too easily
>
> Hello List,
>
> i hope this is the right place to get helped. I have a promising setup for testing
> purposes, but unfortunately i ran quick into problems.
>
> I compiled a minimal libphp7.so (7.2.1) using this line:
> ./configure --disable-all --enable-static --prefix=/usr
> --with-apxs2=/usr/bin/apxs2 --enable-maintainer-zts
>
> I enabled threadsafety to use this libphp7.so in apache 2.4 with a threaded mpm
> like worker or event. the plan is to just load it with LoadModule in apache but
> not to use it.
> the real php-processing is done by a fastcgi-setup in apache using php-fpm (not
> needed to reproduce error). the idea is to support php_value/php_flag etc. in
> .htaccess files for my users even if they use a fastcgi-setup. all i need is
> htscanner extension for php-cgi and just a loaded libphpx.so to register these
> directives in apache. may be this is a dump idea, but i have thousands of users
> who use libphpx.so and a huge number of .htaccess with php_value/php_flag
> directives. currently i see no possibility to tell users to switch to .user.ini
>
> First steps are really successful and all worked well. Even benchmarking the
> system with massrequests did not show any error. php_value/php_flag in
> .htaccess showed expected behaviour when requesting a php-file using fastcgi.
> Unfortunately there is only a small change to see lots of segfaults in
> errorlog: Just enable a php_value directive in VHost-Config for this particular
> VHost along with a php_value directive in .htaccess in docroot of this VHost. It is
> not needed to request a php-file, just requesting a small static file is enough. The
> smaller the requested file and higher requests per second the higher is count of
> segfaults.
>
I just made a quick try with the way you've described - php_value once in httpd.conf and in
.htaccess, but I see no crash. Perhaps you could file a ticket with a more detailed description and
a backtrace you currently get.
> I knew that threadsafe-compiled php is a problematic thing and recommend
> mpm is prefork when not using a fastcgi-configuration, but iam surprised that i
> see the crashes so easily. I used a minimal php and it seems problem occurs just
> by reading and applying the values set by php_value for particular request.
>
It depends on what you do. Some dependencies or even functions in the C runtime are not thread safe,
one has to be aware what is used by an application.
Thanks
Anatol