PHP: php.unit.so segfault with limits.requests>0
When benchmarking my symfony application running in a unit docker container I encountered the following segfault after increasing limits.requests to 1000:
FROM --platform=linux/amd64 unit:1.30.0-php8.2
RUN apt-get update && apt-get -y install libicu-dev \
&& docker-php-ext-install intl \
&& docker-php-ext-install pdo_mysql \
&& echo "zend_extension=opcache.so" > /usr/local/etc/php/conf.d/ext-opcache.ini
"memory_limit": "128M",
"opcache.jit_buffer_size": "128M",
"opcache.max_accelerated_files": "20000",
"opcache.memory_consumption": "256",
"opcache.preload": "/app/config/preload.php",
"opcache.preload_user": "unit",
"opcache.validate_timestamps": "0",
"realpath_cache_size": "4096K",
"realpath_cache_ttl": "600"
unitd: segfault at 78 ip 00007fbe074a7efd sp 00007ffdb6b70ec0 error 4 in php.unit.so[7fbe074a3000+c000]
[9283731.859396] Code: 8d 15 7f 79 00 00 be 02 00 00 00 e8 bd f4 ff ff b8 01 00 00 00 5d c3 66 0f 1f 44 00 00 41 55 41 54 55 48 89 fd 53 48 83 ec 18 <83> 7f 78 02 77 7d 8d 04 d2 41 89 f4 89 d3 44 8d 6c 41 18 48 8b 47
I'm still working on reproducing this issue/getting a proper core dump as:
ERROR: apport (pid 1464528) Sun Jun 18 18:04:23 2023: executable was modified after program start, ignoring
@hanikesn
HI, thanks for the report.
Couple of questions
- Can you confirm the version of Unit you're using?.
- Is this 100% reproducible?
Also, could you provide your unit config (or at least as much as you're comfortable with).
Couple of questions
1. Can you confirm the version of Unit you're using?.
OK, nevermind, I see unit:1.30.0-php8.2
2. Is this 100% reproducible?
I'm guessing not, due to your comment about trying to get coredumps...
I've tried reproducing with the following config on Fedora 38 with latest Unit from git master and PHP 8.2.7
{
"listeners": {
"[::1]:8080": {
"pass": "applications/php"
}
},
"applications": {
"php": {
"type": "php",
"root": "/home/andrew/src/php",
"processes": 5,
"limits": {
"requests": 1000
},
"options": {
"file": "/etc/php.ini",
"admin": {
"memory_limit": "128M",
"opcache.jit_buffer_size": "128M",
"opcache.max_accelerated_files": "20000",
"opcache.memory_consumption": "256",
"opcache.preload": "/home/andrew/src/php/index.php",
"opcache.preload_user": "unit",
"opcache.validate_timestamps": "0",
"realpath_cache_size": "4096K",
"realpath_cache_ttl": "600"
}
}
}
}
}
$ ab -c 20 -n 100000 http://localhost:8080/index.php
and where index.php is simply
<?php
echo "OK\n\n";
print_r($_SERVER);
?>
But no joy yet...