Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 13 Apr 2024 16:25:20 +0000
From:      bugzilla-noreply@freebsd.org
To:        apache@FreeBSD.org
Subject:   [Bug 268318] www/apache24 with www/mod_php8{0,1,2,3?}: opcache + ASLR turned on crashes Apache
Message-ID:  <bug-268318-16115-z3umGKylGA@https.bugs.freebsd.org/bugzilla/>
In-Reply-To: <bug-268318-16115@https.bugs.freebsd.org/bugzilla/>
References:  <bug-268318-16115@https.bugs.freebsd.org/bugzilla/>

next in thread | previous in thread | raw e-mail | index | archive | help
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D268318

--- Comment #88 from Miroslav Lachman <000.fbsd@quip.cz> ---
(In reply to Fabian Wenk from comment #85)
This problem is more complicated with almost each release of Apache or PHP.

About a month ago I tried to debug the issue on 2 of our machines (just the=
 2
crashing, more than a dozen of others don't)

As a workaround Opcache can be disabled by opcache.enable=3D0 in php.ini bu=
t on
some workload the disabled Opcache is too bad for performance.

I was curious why it crashes on those 2 machines and not on the others, I
compared configuration in php.ini and the list of installed PHP extensions.=
 I
thought there are some extra extensions which can cause the problem but it =
was
the other way around - 2 machines had fewer PHP extensions than other machi=
nes.
Once I installed more extensions it stoped crashing the Apache with Opcache
enabled.=20
Then I tried to isolate minimalistic example and it was more complicated ag=
ain.
Even only 2 extensions (one is opcache) can crash Apache on reload.=20
The minimal set of extensions installed to have Apache without crashes was
this:

ext-10-opcache.ini
ext-18-session.ini
ext-20-bcmath.ini
ext-20-bz2.ini
ext-20-ctype.ini
ext-20-curl.ini
ext-20-dom.ini
ext-20-exif.ini
ext-20-fileinfo.ini
ext-20-filter.ini
ext-20-ftp.ini
ext-20-gd.ini
ext-20-iconv.ini
ext-20-intl.ini

Once I remove any of them the Apache will crash on reload with Opcache enab=
led.

The ftp PHP extension was one missing on the 2 mentioned machines.

But when you add bunch of PHP extensions then you play this game again beca=
use
it can start crashing again until you add even more extensions to stop it.

This problem is back again after the latest update of Apache to 2.4.59 on
different machines than before.=20
3 machines where Apache crashed on reload with this version and unmodified =
list
of PHP extensions and unmodified php.ini.
The more interesting is that it crashes Apache with PHP 8.1 on 2 machines a=
nd
PHP 8.3 on third machine. The list of extensions is the same.

Again, it can be worked around by opcache.enable=3D0 but it is not a soluti=
on.
As the configuration of PHP is the same as bunch of other machines which do=
 not
crash I started to dig deeper - the list of Apache modules. And there are s=
ome
differences. The main difference is that Apache with PHP with Opcache crash=
es
on machines where proxy_wstunnel_module is loaded!=20
Once I commented out the LoadModule proxy_wstunnel_module in httpd.conf Apa=
che
survived reload with PHP Opcache enabled. But we cannot disable wstunnel
because it is required by some web apps.
And things are still not clear enough. Another machine with
proxy_wstunnel_module loaded and with PHP Opcache enabled does not crashes
Apache on reload.

So ... there are too many things together which must match to make Apache
(don't) crash.

All tests were with this in rc.conf:
apache24_enable=3D"YES"
apache24_aslr_disable=3D"YES"
apache24_http_accept_enable=3D"YES"

And in case of PHP 8.3 both PHP and mod_php were built with NOASLR =3D On.

--=20
You are receiving this mail because:
You are the assignee for the bug.=



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?bug-268318-16115-z3umGKylGA>