[php-src] Issue #9361: Segmentation fault on script exit
| From: | dvaeversted | Date: | Wed, 17 Aug 2022 20:09:58 +0000 |
| Subject: | [php-src] Issue #9361: Segmentation fault on script exit | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-242238@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/9361
Author: dvaeversted
### Description
After updating from PHP 8.0.X to 8.1.9, we started experiencing segfaults on a memory heavy script.
We run it using the following command line:
php -d memory_limit=8192M cronscript.php
I was unable to construct a reproducer at this time, but no extensions are used, it is a script that
reads in 3 different large files, does some calculations through a bunch of loops, and will crash
with a segfault at the end of script execution (either on exit; or just when no more
lines are left in the script).
We tested it on latest 8.2.0beta3, which exhibits the same problem, backtrace included as well.
From gdb i grabbed the following backtraces.
PHP 8.1.9:
```
Program received signal SIGSEGV, Segmentation fault.
0x00005555559825f8 in zend_set_memory_limit (memory_limit=8589934592) at
/usr/src/debug/php-8.1.9/Zend/zend_alloc.c:2671
2671 heap->cached_chunks = p->next;
(gdb) bt
#0 0x00005555559825f8 in zend_set_memory_limit (memory_limit=8589934592) at
/usr/src/debug/php-8.1.9/Zend/zend_alloc.c:2671
#1 0x00005555559465c0 in php_request_shutdown (dummy=dummy@entry=0x0) at
/usr/src/debug/php-8.1.9/main/main.c:1879
#2 0x0000555555a8f2ae in do_cli (argc=4, argv=0x555555f75190) at
/usr/src/debug/php-8.1.9/sapi/cli/php_cli.c:1135
#3 0x000055555578e2a5 in main (argc=4, argv=0x555555f75190) at
/usr/src/debug/php-8.1.9/sapi/cli/php_cli.c:1367
```
PHP 8.2.0beta3:
```
Program received signal SIGSEGV, Segmentation fault.
0x00005555559929f8 in zend_set_memory_limit (memory_limit=8589934592) at
/usr/src/debug/php-8.2.0beta3/Zend/zend_alloc.c:2692
2692 heap->cached_chunks = p->next;
Missing separate debuginfos, use: debuginfo-install gd3php-2.3.3-4.el7.remi.x86_64
(gdb) bt
#0 0x00005555559929f8 in zend_set_memory_limit (memory_limit=8589934592) at
/usr/src/debug/php-8.2.0beta3/Zend/zend_alloc.c:2692
#1 0x0000555555956260 in php_request_shutdown (dummy=dummy@entry=0x0) at
/usr/src/debug/php-8.2.0beta3/main/main.c:1890
#2 0x0000555555aa1e96 in do_cli (argc=4, argv=0x555555f75190) at
/usr/src/debug/php-8.2.0beta3/sapi/cli/php_cli.c:1135
#3 0x000055555578f9bc in main (argc=4, argv=0x555555f75190) at
/usr/src/debug/php-8.2.0beta3/sapi/cli/php_cli.c:1333
```
### PHP Version
PHP 8.1.9
### Operating System
Centos 7, AlmaLinux 8