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 <der...@php.net> 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=<optimized out>) 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 g...@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
>

Reply via email to