Repository navigation
Assertion with function/tracing JIT #12428
Copy link
Copy link
Closed
Labels
Description
Description
Description
Running the infection phpunit testsuite, commit 2789fdd689689b0c85f2c0ae9db50c8d2b39fb92 throws an assertion:
php: /root/php-src/Zend/zend_execute.c:251: zval *_get_zval_ptr_tmp(uint32_t, zend_execute_data *): Assertion `zval_get_type(&(*(ret))) != 10' failed.
php.ini:
memory_limit = -1
zend.assertions = 1
display_errors = On
display_startup_errors = On
extension=uv
extension=gmp
extension=iconv
[opcache]
zend_extension=opcache
opcache.memory_consumption=4096M
opcache.enable=1
opcache.enable_cli=1
opcache.jit=tracing
opcache.validate_timestamps=0
opcache.jit_buffer_size=1G
opcache.file_update_protection=0
opcache.max_accelerated_files=1000000
opcache.interned_strings_buffer=64
;opcache.jit_debug=28672
;opcache.jit_debug=16384
opcache.jit_prof_threshold=0.000000001
opcache.jit_max_root_traces= 30000000
opcache.jit_max_side_traces= 30000000
opcache.jit_max_exit_counters=30000000
opcache.jit_hot_loop=1
opcache.jit_hot_func=1
opcache.jit_hot_return=1
opcache.jit_hot_side_exit=1
opcache.jit_blacklist_root_trace=255
opcache.jit_blacklist_side_trace=255
opcache.protect_memory=1
Command:
php patch.php vendor/bin/phpunit ./tests/phpunit/Configuration/Schema/SchemaConfigurationFactoryTest.php --filter test_it_can_create_a_config --debug
Result:
patch.php from https://github.com/php/php-src/pull/12425/files:
<?php
register_shutdown_function(function () {
$status = opcache_get_status(false);
var_dump($status);
$ok = true;
if ($status["memory_usage"]["free_memory"] < 10*1024*1024) {
echo "Not enough free opcache memory!".PHP_EOL;
$ok = false;
}
if ($status["interned_strings_usage"]["free_memory"] < 1*1024*1024) {
echo "Not enough free interned strings memory!".PHP_EOL;
$ok = false;
}
if ($status["jit"]["buffer_free"] < 10*1024*1024) {
echo "Not enough free JIT memory!".PHP_EOL;
$ok = false;
}
if (!$status["jit"]["on"]) {
echo "JIT is not enabled!".PHP_EOL;
$ok = false;
}
unset($status);
gc_collect_cycles();
if (!$ok) die(130);
});
$argc--;
array_shift($argv);
$_SERVER['argc']--;
array_shift($_SERVER['argv']);
require $argv[0];Ping @dstogov
PHP Version
Operating System
No response
Reactions are currently unavailable
Activity
danog commentedon Oct 12, 2023
Full output:
danog commentedon Oct 12, 2023
Same assertion occurs when using function JIT, not when JIT is disabled.
[-]Assertion with tracing JIT[/-][+]Assertion with function/tracing JIT[/+]danog commentedon Oct 12, 2023
Backtraces:
danog commentedon Oct 15, 2023
Minimal reproducer:
Fixed GH-12428: Assertion with function/tracing JIT
Merge branch 'PHP-8.1' into PHP-8.2
Merge branch 'PHP-8.2' into PHP-8.3
Merge branch 'PHP-8.3'
dstogov commentedon Oct 16, 2023
Thanks for the small test case. It's fixed now.
When do you plan to land all these community tests improvements?
danog commentedon Oct 16, 2023
Hi @dstogov, no problem, but it seems another similar assertion is still being emitted when running the testsuite, will try to isolate again but maybe there's another similar place in the code that can trigger the issue?
Regarding the testsuite improvements PRs, #12425 is ready to merge, as is #12406.
Will submit a new PR with a nightly test for infection, and another PR that further improves JIT coverage by running all unit tests 3x times in a php-fpm daemon, or by using the file cache this weekend.
dstogov commentedon Oct 18, 2023
I can't reproduce the bug with infection
danog commentedon Oct 19, 2023
Hi @dstogov, I can reproduce with this slightly reduced testcase using commit 745a346 of php-src:
The same assertion also occurs when running phpunit.
Same config as usual:
dstogov commentedon Oct 23, 2023
I still can't reproduce this
danog commentedon Oct 23, 2023
Indeed, can't reproduce anymore with https://github.com/danog/jit_bugs, quite strange, closing this then.