Topic: PHP SCL 7.4 fails with segfault

On CentOS 7.9 it often fails with segfault using the matomo php app.
This will logged:

Dec 23 06:28:47 kernel: php-fpm[1649]: segfault at 8 ip 000055ac13a51a4d sp 00007ffc5c96c3e0 error 4 in php-fpm[55ac1371e000+474000]
Dec 23 06:28:55 kernel: php-fpm[1646]: segfault at 8 ip 000055ac13a51a4d sp 00007ffc5c96c3e0 error 4 in php-fpm[55ac1371e000+474000]
Dec 23 06:28:56 kernel: php-fpm[22464]: segfault at 55ac13b1bcc0 ip 000055ac13a51b70 sp 00007ffc5c96c3e0 error 7 in php-fpm[55ac1371e000+474000]
Dec 23 06:28:56 kernel: traps: php-fpm[22463] general protection ip:55ac139e1fea sp:7ffc5c96c330 error:0 in php-fpm[55ac1371e000+474000]
Dec 23 06:28:58 kernel: php-fpm[1645]: segfault at 8 ip 000055ac13a51a4d sp 00007ffc5c96c3e0 error 4 in php-fpm[55ac1371e000+474000]
Dec 23 06:28:59 kernel: php-fpm[1648]: segfault at 55ac13b1bcc0 ip 000055ac13a51b70 sp 00007ffc5c96c3e0 error 7 in php-fpm[55ac1371e000+474000]
Dec 23 06:29:00 kernel: php-fpm[1647]: segfault at 8 ip 000055ac13a51a4d sp 00007ffc5c96c3e0 error 4 in php-fpm[55ac1371e000+474000]
Dec 23 06:29:01 kernel: php-fpm[22449]: segfault at 7f8dadb4b3b8 ip 000055ac13a51a04 sp 00007ffc5c96c3e0 error 4 in php-fpm[55ac1371e000+474000]
Dec 23 06:29:05 kernel: php-fpm[22465]: segfault at 8 ip 000055ac13a51a4d sp 00007ffc5c96c3e0 error 4 in php-fpm[55ac1371e000+474000]

Package: php74-php-fpm-7.4.13-2.el7.remi.x86_64

Re: PHP SCL 7.4 fails with segfault

Need a simple reproducer
Or a gdb backtrace
And probably have to be reported upstream

Also a list of installed extensions may help (rpm -qa php74\*; PHP -m)

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

3 (edited by mdc_systems 2020-12-23 06:41:51)

Re: PHP SCL 7.4 fails with segfault

It looks like it is this problem:
https://github.com/matomo-org/matomo/issues/16898
So the problems comes from the geoip module.

Here the list of the uses modules:
php74-php-pecl-apcu-5.1.19-1.el7.remi.x86_64
php74-php-opcache-7.4.13-2.el7.remi.x86_64
php74-php-gd-7.4.13-2.el7.remi.x86_64
php74-php-common-7.4.13-2.el7.remi.x86_64
php74-php-fpm-7.4.13-2.el7.remi.x86_64
php74-php-cli-7.4.13-2.el7.remi.x86_64
php74-php-pdo-7.4.13-2.el7.remi.x86_64
php74-php-mbstring-7.4.13-2.el7.remi.x86_64
php74-php-json-7.4.13-2.el7.remi.x86_64
php74-php-xml-7.4.13-2.el7.remi.x86_64
php74-php-soap-7.4.13-2.el7.remi.x86_64
php74-php-pecl-apcu-bc-1.0.5-3.el7.remi.x86_64
php74-php-process-7.4.13-2.el7.remi.x86_64
php74-php-pecl-zip-1.19.2-1.el7.remi.x86_64
php74-php-pecl-imagick-3.4.4-10.el7.remi.x86_64
php74-php-mysqlnd-7.4.13-2.el7.remi.x86_64
php74-php-intl-7.4.13-2.el7.remi.x86_64
php74-runtime-1.0-3.el7.remi.x86_64
php74-php-pecl-geoip-1.1.1-11.el7.remi.x86_64

Re: PHP SCL 7.4 fails with segfault

Removing the php74-php-pecl-geoip-1.1.1-11.el7.remi.x86_64 package will "solve" it.

Re: PHP SCL 7.4 fails with segfault

Thanks for info

BTW, geoip is probably a bad idea, this project seems mostly dead.
And better alternative exists: maxmindb or perhaps ip2location (this one is young)

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: PHP SCL 7.4 fails with segfault

Looks like mamoto 4 supports maxmindb database and includes the needed libraries
https://matomo.org/docs/geo-locate/


And the php74-php-pecl-maxmindb extension will make things faster.

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: PHP SCL 7.4 fails with segfault

Matomo can use geoip2, so in this case it is not an big problem. But for other projects cant it be one.

Re: PHP SCL 7.4 fails with segfault

In all cases using old deprecated GeoIP database IS a problem

BTW, I will try to reproduce the segfault and see if a fix is possible.
but as, I said, the geoip extension seems dead...

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi

Re: PHP SCL 7.4 fails with segfault

Sadly, I was not able to reproduce segfault with geoip extension (and don't see any usage of it in matomo 4 code)

Laptop:  Fedora 38 + rpmfusion + remi (SCL only)
x86_64 builder: Fedora 39 + rpmfusion + remi-test
aarch64 builder: RHEL 9 with EPEL
Hosting Server: CentOS 8 Stream with EPEL, rpmfusion, remi