Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:113375 Return-Path: Delivered-To: mailing list internals@lists.php.net Received: (qmail 60267 invoked from network); 4 Mar 2021 13:41:28 -0000 Received: from unknown (HELO php-smtp4.php.net) (45.112.84.5) by pb1.pair.com with SMTP; 4 Mar 2021 13:41:28 -0000 Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id 7DE701804F6 for ; Thu, 4 Mar 2021 05:32:13 -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=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,HTML_MESSAGE, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.2 X-Spam-Virus: No X-Envelope-From: Received: from mail-vk1-f170.google.com (mail-vk1-f170.google.com [209.85.221.170]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 4 Mar 2021 05:32:12 -0800 (PST) Received: by mail-vk1-f170.google.com with SMTP id e25so2234348vkd.4 for ; Thu, 04 Mar 2021 05:32:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=bB7jvWKWqZJzWPzzX6IvQDkJOUiY5HUammmh3Xdh8HQ=; b=fAKHB0umS6pI6LftD8AyRU0pSBSMer6ORQehkdNj5k5I+3ZVji8vnvfNbnSnZ7fIgd MpiIAJ4CuKBR232KHwISTpQKfBwl0GSfV8FsSwutJPnjDFkzWOSBV7vtiLzichkDHrMM U3jbADrXwwaXmDHp/+GywWgRtHJche3IJs11K470Jj+SslTo6gZ5EyfnHsHSbQrANr55 a1Lp7g6pkuN0E74+pGLa49zy1+lxO9hZz4XbwdUaGd8o4Wa6YLvbZBAyMGAiTTHCVZGz 2qU77FhlsBAfFPL/RCoLzxdx12LA5RQr2Mz1F/5oQfHl9lIsx9t2uXVYj4fQHmT+pKEq Sa/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=bB7jvWKWqZJzWPzzX6IvQDkJOUiY5HUammmh3Xdh8HQ=; b=SAzqMLWYMaxlCORUCg7w+R71aoZ3hT0Vts7oSOoID1V7XUDc+eKSHA4FB4+m+RUyJr n+qKONKJGplgREzM171Z8Im8kkzNdGuid7he+G3OdYOw7EkYrfOsKxb4C4GqHMCTJ8m3 vNzucOwwOYdnfiuV2+9RbFqUwZ2hslYWLahFprfE4lTYVEejDTGghH+a50nYyUOImGp6 6fcSGNLxpuM3UI5Wji8F8uVe9goM7vJfh20/G0ZrzoHC6lv0sxPbDoXyA45zriNbWrXB 43+F0iLNXTGXhuV8ixGVEigJO3N5vgYpWZDnCvohVZYkVSmwwwKmY69E6Gqw7jJi6PzF dOaA== X-Gm-Message-State: AOAM5309crppQGj0BsVxsr8VHcOO3kEGizuw04eSQEArnEi2Qh+aIGAC ZzoC/NU2XXThnWe078h/MrDZzLMdy0bmF1r4i+M= X-Google-Smtp-Source: ABdhPJx1PCBkLmQp0tzE5QOhqDJ3isaFQr86nZ4ZcR2GZcYotd/9HjB+zJsDBcvksVyyN83eOuujHqIUKIVVNDnZrMQ= X-Received: by 2002:a1f:1f96:: with SMTP id f144mr2404776vkf.16.1614864731033; Thu, 04 Mar 2021 05:32:11 -0800 (PST) MIME-Version: 1.0 References: In-Reply-To: Date: Thu, 4 Mar 2021 16:32:00 +0300 Message-ID: To: Derick Rethans Cc: Nikita Popov , PHP Developers Mailing List Content-Type: multipart/alternative; boundary="000000000000a7542b05bcb5feb9" Subject: Re: Recent changes to opcache cause crashes when loaded with Xdebug From: dmitrystogov@gmail.com (Dmitry Stogov) --000000000000a7542b05bcb5feb9 Content-Type: text/plain; charset="UTF-8" We already made few significant changes in PHP-8.1. e.g. most classes and methods are immutable. It's not allowed to change them (this is the same as before, but now almost all of them are immutable). Use opcache.protect_memory=1 to catch potentially wrong modification. From the quick look, I don't see how zend_map_ptr_new() may return 0 or 1 at this point. I'll be able to run xdebug tests only in the middle of the next week. Thanks. Dmitry. On Thu, Mar 4, 2021 at 3:41 PM Derick Rethans wrote: > 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 > --000000000000a7542b05bcb5feb9--