-
Notifications
You must be signed in to change notification settings - Fork 7.9k
JIT Assertion `info & (1 << type)' failed #12512
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
This scenario is not reproducible with PHP master branch. |
@dstogov Cleaned up the reproducer a bit, could you try? |
I'll try this tomorrow (actually today morining). Could you please also add the following patch to allow debugging in container. diff --git a/Dockerfile b/Dockerfile
index f682628..a10d887 100755
--- a/Dockerfile
+++ b/Dockerfile
@@ -28,7 +28,8 @@ RUN true \
pkg-config autoconf bison re2c \
libxml2-dev libsqlite3-dev \
systemtap-sdt-dev libssl-dev \
- libpcre2-dev libargon2-dev libedit-dev libsodium-dev llvm-16 libonig-dev
+ libpcre2-dev libargon2-dev libedit-dev libsodium-dev llvm-16 libonig-dev \
+ gdb libcapstone-dev
RUN git clone https://github.com/php/php-src -b master --depth 1 && cd php-src \
\
@@ -46,6 +47,7 @@ RUN git clone https://github.com/php/php-src -b master --depth 1 && cd php-src \
--with-password-argon2=/usr --with-external-pcre --with-mhash=/usr --with-libxml \
--enable-session --with-sodium --with-zlib=/usr --with-zlib-dir=/usr \
--enable-pcntl --with-libedit=shared,/usr \
+ --with-capstone \
\
&& export CFLAGS='-g -fsanitize=address -shared-libasan -fno-sanitize-recover -DZEND_TRACK_ARENA_ALLOC' \
&& export CPPFLAGS='-g -fsanitize=address -shared-libasan -fno-sanitize-recover -DZEND_TRACK_ARENA_ALLOC' \
@@ -64,6 +66,6 @@ RUN git config --global --add safe.directory /app
ENV USE_ZEND_ALLOC=0
ENV PSALM_ALLOW_XDEBUG=1
-ENV ASAN_OPTIONS="detect_leaks=0:exitcode=139"
+ENV ASAN_OPTIONS="detect_leaks=0:exitcode=139:abort_on_error=true"
WORKDIR /app |
Done!
Actually it's set to 0 in the Dockerfile, the new setting should speed up stuff a bit :) |
Right. My mistake. Now I see the assertions. |
@dstogov --threads=1 can help with that! |
The reduced test case <?php
function bar(array &$a): ?bool {
$ret = null;
foreach ($a as $key => $val) {
if ($val === 2) {
unset($a[$key]);
}
}
return $ret;
}
function foo($a, bool $b): bool {
if ($b) return true;
$n2 = count($a);
do {
$n = $n2;
$res = bar($a);
$n2 = count($a);
} while ($res === null && $n !== $n2);
if ($res === null && $n === 0) {
return false;
}
return true;
}
$a = [1,'a'=>5];
bar($a);
foo([1,'a'=>5], true);
foo([1,'a'=>5], false);
foo([2,'a'=>5], false);
?> |
This should be partially fixed by 93d5c0e There are no assertions when running psalm with |
Hmm, will see if I can reduce this this weekend... |
The assertion disappears if |
Thank you for all the work on the fixes @dstogov! Also, since it seems like Psalm should now work fine, could you please take a look at and merge the following PRs when you have some free time?
Thanks :) |
Thanks for the test cases that helped to fix the bugs! :)
No. The assertion occurred in some worker on 7 test inside a container (it didn't stop the test).
All your https://github.com/danog/jit_bugs are fixed now?
I'm not sure if all these PRs should be merged. It's a question about load, execution time, etc cc @iluuu1994 |
@danog Sorry for taking a long time to get back. The PRs are a bit all over the place. 🙂 Some things are in multiple PRs or unrelated. I'll take some time today to review them. I think adding more things to the COMMUNITY tests is fine, as long as it's usefulness is proportional to the additional execution time. Of course, at some points we'll have diminishing returns. For the COMMUNITY tests, it would be helpful if you temporarily copied them to |
Hi @dstogov and @iluuu1994,
It seems like it, I could not reproduce any of the issues.
Tested with PHP 8.3, not quite sure about which changes are needed, shouldn't the ones I use in the repo already increase the likelyhood of catching JIT bugs?
Even with an old pre-3844593 commit, I could not for the life of me reproduce the silent assertions.
I've made the simpler thing, I've started a CI task for #12406 on my repo: https://github.com/danog/php-src/actions/runs/6837624271/job/18593863162 |
Great! And thank you for helping fixing all these bugs!
I meant just changing the branch in |
Description
https://github.com/danog/jit_bugs, reproducer 7.
Result:
Followed by an impossible
RuntimeException PHP Error: Array to string conversion in /app/src/Psalm/Type/Atomic/TGenericObject.php
, exactly from #12255.ping @dstogov
PHP Version
3fb685b
Operating System
No response
The text was updated successfully, but these errors were encountered: