Bug 277888 - lang/php83: segmentation fault on unloading modules on FreeBSD 13.2 and 13.3
Summary: lang/php83: segmentation fault on unloading modules on FreeBSD 13.2 and 13.3
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: Muhammad Moinur Rahman
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-03-22 14:31 UTC by wolfgang
Modified: 2024-05-13 13:05 UTC (History)
0 users

See Also:
bugzilla: maintainer-feedback? (bofh)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description wolfgang 2024-03-22 14:31:22 UTC
When php83 is installed together with certain extensions in a certain order, php scripts throw a segmenation fault at the end after finishing their task, apparently on unloading the dynamic libraries from the extensions. This does happen even when none of the installed extensions is actually used. I can reproduce it in two environments: Jail with userland from 13.2-10 running on a 13.9 host with 2024Q1 packages, and on a physical host running 13.3-STABLE stable/13-n257383-49e8190c76c1 with packages from the MAIN branch.
I can NOT reproduce the problem on 14.0-RELEASE-p5 though

How to reproduce:
On a FreeBSD 13 installation without php run:
pkg install php83 php83-bcmath php83-bz2 php83-calendar php83-composer php83-curl php83-deployer php83-exif php83-fileinfo php83-ftp php83-gd php83-gettext php83-gmp php83-iconv php83-imap php83-ldap php83-mbstring php83-mysqli php83-opcache php83-pcntl php83-pdo_mysql php83-pdo_pgsql php83-pdo_sqlite php83-pecl-APCu php83-pecl-gnupg php83-pecl-grpc php83-pecl-igbinary php83-pecl-imagick php83-pecl-redis php83-pecl-ssh2 php83-pecl-vips php83-posix php83-pspell php83-readline php83-simplexml

After finishing that installation, run:
php -r 'proc_open(["date"], [], $pipes);'

On FreeBSD 13 I get:
$ php -r 'proc_open(["date"], [], $pipes);'
Fri Mar 22 15:26:24 CET 2024
Segmentation fault
$ 

On FreeBSD 14 I get:
$ php -r 'proc_open(["date"], [], $pipes);'
Fri Mar 22 15:25:46 CET 2024
$ 

Please note that the test script does not use any of the extensions, it runs quite fine on php83 alone.
Comment 1 Muhammad Moinur Rahman freebsd_committer freebsd_triage 2024-03-22 23:48:07 UTC
Currently I do no longer have any 13 boxes in production so cannot confirm this. However this might be an issue with some posix patches I removed before the quarterly and was again reintroduced which was not later merged into the quarterly.

But let me know if you can find any order in which it does not break. In the ports framework we can load and unload the php modules in a specific order. This order has been a long outstanding issue hence we introduced this for manual intervention.
Comment 2 wolfgang 2024-05-13 13:05:51 UTC
After linking php83-gd with graphics/gd that has the newly introduced THREADS option set, I can no longer reproduce the problem. So maybe this was the problem.