Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113370 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 49951 invoked from network); 4 Mar 2021 12:51:09 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 4 Mar 2021 12:51:09 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 775361804B8 for ; Thu, 4 Mar 2021 04:41:54 -0800 (PST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on php-smtp4.php.net X-Spam-Level: X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00,SPF_HELO_PASS, SPF_NEUTRAL autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from xdebug.org (xdebug.org [82.113.146.227]) by php-smtp4.php.net (Postfix) with ESMTP for ; Thu, 4 Mar 2021 04:41:53 -0800 (PST) Received: from localhost (localhost [IPv6:::1]) by xdebug.org (Postfix) with ESMTPS id 1F10D10C066; Thu, 4 Mar 2021 12:41:53 +0000 (GMT) Date: Thu, 4 Mar 2021 12:41:53 +0000 (GMT) X-X-Sender: derick@singlemalt.home.derickrethans.nl To: Dmitry Stogov , Nikita Popov cc: PHP Developers Mailing List Message-ID: User-Agent: Alpine 2.23 (DEB 453 2020-06-18) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Subject: Recent changes to opcache cause crashes when loaded with Xdebug From: derick@php.net (Derick Rethans) Hi, I've been doing some work on making Xdebug run with PHP 8.1 (master) again, and after my fixes (https://github.com/xdebug/xdebug/pull/728/files) I am still running into a crash (or rather, assert, in opcache): php: /home/derick/dev/php/php-src.git/ext/opcache/zend_persist.c:327: zend_accel_get_type_map_ptr: Assertion `ret > 2' failed. Program received signal SIGABRT, Aborted. __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50 50 ../sysdeps/unix/sysv/linux/raise.c: No such file or directory. (gdb) bt #0 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:50 #1 0x00007ffff6bc5537 in __GI_abort () at abort.c:79 #2 0x00007ffff6bc540f in __assert_fail_base (fmt=0x7ffff6d2e128 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n", assertion=0x7ffff45b7584 "ret > 2", file=0x7ffff45b7410 "/home/derick/dev/php/php-src.git/ext/opcache/zend_persist.c", line=327, function=) at assert.c:92 #3 0x00007ffff6bd4662 in __GI___assert_fail (assertion=0x7ffff45b7584 "ret > 2", file=0x7ffff45b7410 "/home/derick/dev/php/php-src.git/ext/opcache/zend_persist.c", line=327, function=0x7ffff45b7810 <__PRETTY_FUNCTION__.6> "zend_accel_get_type_map_ptr") at assert.c:101 #4 0x00007ffff44a1328 in zend_accel_get_type_map_ptr (type_name=0x4021bbb0, scope=0x408beca0) at /home/derick/dev/php/php-src.git/ext/opcache/zend_persist.c:327 #5 0x00007ffff44a15a2 in zend_persist_type (type=0x408bf068, scope=0x408beca0) at /home/derick/dev/php/php-src.git/ext/opcache/zend_persist.c:352 #6 0x00007ffff44a292a in zend_persist_op_array_ex (op_array=0x408bef00, main_persistent_script=0x0) at /home/derick/dev/php/php-src.git/ext/opcache/zend_persist.c:630 #7 0x00007ffff44a34de in zend_persist_class_method (zv=0x408beec0, ce=0x408beca0) at /home/derick/dev/php/php-src.git/ext/opcache/zend_persist.c:765 #8 0x00007ffff44a40f8 in zend_persist_class_entry (orig_ce=0x555557324b28) at /home/derick/dev/php/php-src.git/ext/opcache/zend_persist.c:876 #9 0x00007ffff44a7047 in zend_accel_persist_class_table (class_table=0x408beaf0) at /home/derick/dev/php/php-src.git/ext/opcache/zend_persist.c:1225 #10 0x00007ffff44a7845 in zend_accel_script_persist (script=0x408be9c0, key=0x7fffffff99e0, key_length=80, for_shm=1) at /home/derick/dev/php/php-src.git/ext/opcache/zend_persist.c:1286 #11 0x00007ffff448c2e3 in cache_script_in_shared_memory (new_persistent_script=0x55555739a8b0, key=0x408beb88 "coverage4.inc:2502976:2352312:/home/derick/dev/php/derickr-xdebug/tests/coverage", key_length=80, from_shared_memory=0x7fffffff9adc) at /home/derick/dev/php/php-src.git/ext/opcache/ZendAccelerator.c:1550 #12 0x00007ffff448f3b2 in persistent_compile_file (file_handle=0x7fffffff9b80, type=2) at /home/derick/dev/php/php-src.git/ext/opcache/ZendAccelerator.c:2181 #13 0x00007ffff4402461 in xdebug_compile_file (file_handle=0x7fffffff9b80, type=2) at /home/derick/dev/php/derickr-xdebug/src/base/base.c:75 #14 0x0000555555d8bf25 in compile_filename (type=2, filename=0x408be620) at Zend/zend_language_scanner.l:727 #15 0x0000555555e31b86 in zend_include_or_eval (inc_filename=0x408be620, type=2) at /home/derick/dev/php/php-src.git/Zend/zend_execute.c:4270 #16 0x0000555555e40d13 in ZEND_INCLUDE_OR_EVAL_SPEC_CONST_HANDLER () at /home/derick/dev/php/php-src.git/Zend/zend_vm_execute.h:4697 #17 0x0000555555e3ba87 in ZEND_USER_OPCODE_SPEC_HANDLER () at /home/derick/dev/php/php-src.git/Zend/zend_vm_execute.h:3019 #18 0x0000555555eabc4c in execute_ex (ex=0x555557334b40) at /home/derick/dev/php/php-src.git/Zend/zend_vm_execute.h:54826 #19 0x00007ffff4404838 in xdebug_execute_ex (execute_data=0x555557334b40) at /home/derick/dev/php/derickr-xdebug/src/base/base.c:765 #20 0x0000555555eb02b6 in zend_execute (op_array=0x5555571afcf0, return_value=0x0) at /home/derick/dev/php/php-src.git/Zend/zend_vm_execute.h:59065 #21 0x0000555555dfba96 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /home/derick/dev/php/php-src.git/Zend/zend.c:1689 #22 0x0000555555d4e84d in php_execute_script (primary_file=0x7fffffffd580) at /home/derick/dev/php/php-src.git/main/main.c:2489 #23 0x0000555555f5ad32 in do_cli (argc=88, argv=0x555556fb0e10) at /home/derick/dev/php/php-src.git/sapi/cli/php_cli.c:964 #24 0x0000555555f5bd80 in main (argc=88, argv=0x555556fb0e10) at /home/derick/dev/php/php-src.git/sapi/cli/php_cli.c:1357 To reproduce: - Check out xdebug from GIT, and switch to the php81-fixes branch: git clone git@github.com:derickr/xdebug.git && cd xdebug && git checkout php81-fixes - Compile and install phpize && ./configure --enable-xdebug-dev && make clean && make all && make install - Run tests: OPCACHE=yes php run-xdebug-tests.php (This should show the error, and create the .php file used below): - For an individual test that shows it (with php.ini disabled): /usr/local/php/master-zts/bin/php -n -dzend_extension=opcache -dzend_extension=xdebug -d "opcache.enable=1" -d "opcache.enable_cli=1" -d "opcache.optimization_level=-1" -d "xdebug.mode=coverage" -d "xdebug.start_with_request=default" -f "/home/derick/dev/php/derickr-xdebug/tests/coverage/coverage4-php74.php" - Loading order does not matter: /usr/local/php/master-zts/bin/php -n -dzend_extension=xdebug -dzend_extension=opcache -d "opcache.enable=1" -d "opcache.enable_cli=1" -d "opcache.optimization_level=-1" -d "xdebug.mode=coverage" -d "xdebug.start_with_request=default" -f "/home/derick/dev/php/derickr-xdebug/tests/coverage/coverage4-php74.php" - Not loading opcache does work: /usr/local/php/master-zts/bin/php -n -dzend_extension=xdebug -d "opcache.enable=1" -d "opcache.enable_cli=1" -d "opcache.optimization_level=-1" -d "xdebug.mode=coverage" -d "xdebug.start_with_request=default" -f "/home/derick/dev/php/derickr-xdebug/tests/coverage/coverage4-php74.php" cheers, Derick -- PHP 7.4 Release Manager Host of PHP Internals News: https://phpinternals.news Like Xdebug? Consider supporting me: https://xdebug.org/support https://derickrethans.nl | https://xdebug.org | https://dram.io twitter: @derickr and @xdebug