[php-src] Issue #11716: cli server crashes on SIGINT when compiled with ZEND_RC_DEBUG=1
| From: | ju1ius | Date: | Sun, 16 Jul 2023 20:41:07 +0000 |
| Subject: | [php-src] Issue #11716: cli server crashes on SIGINT when compiled with ZEND_RC_DEBUG=1 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-244975@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/11716
Author: ju1ius
### Description
Steps to reproduce:
* PHP must be compiled with
--enable-debug and
CFLAGS="-DZEND_RC_DEBUG=1"
* launch a cli server like php -S localhost:8888
* terminate the process with a SIGINT (i.e. CTRL+C)
Here's the gdb backtrace:
```gdb
__pthread_kill_implementation (threadid=<optimized out>, signo=signo@entry=6,
no_tid=no_tid@entry=0) at ./nptl/pthread_kill.c:44
0x00007fd65fdba15f in __pthread_kill_internal (signo=6, threadid=<optimized out>) at
./nptl/pthread_kill.c:78
0x00007fd65fd6c472 in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
0x00007fd65fd564b2 in __GI_abort () at ./stdlib/abort.c:79
0x00007fd65fd563d5 in __assert_fail_base (fmt=0x7fd65fecadc8 "%s%s%s:%u: %s%sAssertion
`%s' failed.\n%n",
assertion=assertion@entry=0x5582e4bcde80 "(zval_gc_flags((p)->u.type_info) &
((1<<7)|(1<<8))) != (1<<7)",
file=file@entry=0x5582e4bcde18 "/usr/src/php-src/Zend/zend_types.h",
line=line@entry=1289,
function=function@entry=0x5582e4bce468 <__PRETTY_FUNCTION__.62>
"zend_gc_delref") at ./assert/assert.c:92
0x00007fd65fd653a2 in __assert_fail (
assertion=0x5582e4bcde80 "(zval_gc_flags((p)->u.type_info) &
((1<<7)|(1<<8))) != (1<<7)",
file=0x5582e4bcde18 "/usr/src/php-src/Zend/zend_types.h", line=1289,
function=0x5582e4bce468 <__PRETTY_FUNCTION__.62> "zend_gc_delref") at
./assert/assert.c:101
0x00005582e4867e74 in zend_gc_delref (p=0x5582e52c8210) at /usr/src/php-src/Zend/zend_types.h:1289
0x00005582e4868109 in zend_string_release (s=0x5582e52c8210) at
/usr/src/php-src/Zend/zend_string.h:345
0x00005582e486e022 in zend_hash_destroy (ht=0x5582e50237a8 <server+648>) at
/usr/src/php-src/Zend/zend_hash.c:1738
0x00005582e49d7e23 in php_cli_server_dtor (server=0x5582e5023520 <server>) at
/usr/src/php-src/sapi/cli/php_cli_server.c:2333
0x00005582e49d8f82 in do_cli_server (argc=4, argv=0x5582e5150770) at
/usr/src/php-src/sapi/cli/php_cli_server.c:2864
0x00005582e49cefeb in main (argc=4, argv=0x5582e5150770) at /usr/src/php-src/sapi/cli/php_cli.c:1340
```
Looks like this assertion:
```c
ZEND_ASSERT((zval_gc_flags((p)->u.type_info) & (GC_PERSISTENT|GC_PERSISTENT_LOCAL)) !=
GC_PERSISTENT);
```
fails when calling
```c
zend_hash_destroy(&server->extension_mime_types);
```
### PHP Version
php8.3-dev
### Operating System
debian sid