Skip to content
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

Bug with concurrency compiling in OPcache #5185

Closed
allsilaevex opened this issue Nov 10, 2023 · 2 comments
Closed

Bug with concurrency compiling in OPcache #5185

allsilaevex opened this issue Nov 10, 2023 · 2 comments

Comments

@allsilaevex
Copy link

  1. What did you do? If possible, provide a simple script for reproducing the error.
php main.php

main.php

<?php

$createProcess = static function () {
    return new Swoole\Process(static function () {
        require_once __DIR__ . '/required.php';
    });
};

$count = 10; // 10 - for example
$processes = [];

foreach (range(0, $count) as $n) {
    $processes[] = $createProcess();
}

foreach ($processes as $process) {
    $process->start();
}

foreach (range(0, $count) as $n) {
    Swoole\Process::wait(true);
}

required.php

<?php

class Foo__ {}

foreach (range(0, 10_000) as $i) { // 10_000 - for example
    \class_alias(Foo__::class, 'Bar__' . $i, false);
}
  1. What did you expect to see?

correct work

  1. What did you see instead?

error not every script run! it works for me every few times with opcache.enable = 1
if you disable opcache (opcache.enable = 0), the bug does not reoccur

output

Assertion failed: zv != ((void*)0) (/usr/src/php/Zend/zend_vm_execute.h: zend_get_opcode_handler_func: 64195)

core dump

#0  0x00007fbd32029d07 in setjmp () from /lib/ld-musl-x86_64.so.1
#1  0x00007fbd32029e5c in raise () from /lib/ld-musl-x86_64.so.1
#2  0x0000003000000010 in ?? ()
#3  0x00007ffd227489b0 in ?? ()
#4  0x00007ffd227488f0 in ?? ()
#5  0x00007fbd31107781 in dasm_actions () from /usr/local/lib/php/extensions/debug-non-zts-20220829/opcache.so
#6  0x3c8649b0a918003e in ?? ()
#7  0x0000561badca30f0 in ?? ()
#8  0x0000561badca2cb8 in ?? ()
#9  0x0000561badcaa8a0 in ?? ()
#10 0x000000000000fac3 in ?? ()
#11 0x00007fbaa74c0300 in ?? ()
#12 0x00007fbaa74c0534 in ?? ()
#13 0x0000003000000018 in ?? ()
#14 0x00007ffd22748a10 in ?? ()
#15 0x00007ffd22748950 in ?? ()
#16 0x3c8649b0a918003e in ?? ()
#17 0x00007fbca774b358 in ?? ()
#18 0x00007fbae7d61230 in ?? ()
#19 0x00007ffd227489e0 in ?? ()
#20 0x00007fbd31ffcfa8 in abort () from /lib/ld-musl-x86_64.so.1
#21 0x00007fbaa76d8e00 in ?? ()
#22 0x00007fbcaf796730 in ?? ()
#23 0x00007ffd227489b0 in ?? ()
#24 0x0000561bad1d168b in zend_hash_index_find (ht=<error reading variable: Cannot access memory at address 0xffffffffffffffe8>, h=<error reading variable: Cannot access memory at address 0xffffffffffffffe0>) at /usr/src/php/Zend/zend_hash.c:2608
  1. What version of Swoole are you using (show your php --ri swoole)?
swoole

Swoole => enabled
Author => Swoole Team <team@swoole.com>
Version => 5.1.0
Built => Nov 10 2023 07:26:12
coroutine => enabled with boost asm context
debug => enabled
trace_log => enabled
epoll => enabled
eventfd => enabled
signalfd => enabled
spinlock => enabled
rwlock => enabled
openssl => OpenSSL 3.1.4 24 Oct 2023
dtls => enabled
http2 => enabled
json => enabled
curl-native => enabled
pcre => enabled
c-ares => 1.19.1
zlib => 1.2.13
brotli => E16777225/D16777225
mutex_timedlock => enabled
pthread_barrier => enabled
futex => enabled
mysqlnd => enabled
async_redis => enabled

Directive => Local Value => Master Value
swoole.enable_coroutine => On => On
swoole.enable_library => On => On
swoole.enable_fiber_mock => Off => Off
swoole.enable_preemptive_scheduler => Off => Off
swoole.display_errors => On => On
swoole.use_shortname => On => On
swoole.unixsock_buffer_size => 8388608 => 8388608
  1. What is your machine environment used (show your uname -a & php -v & gcc -v) ?
Linux 3c54021d9c74 5.15.0-88-generic #98-Ubuntu SMP Mon Oct 2 15:18:56 UTC 2023 x86_64 Linux

PHP 8.2.12 (cli) (built: Nov 10 2023 07:21:43) (NTS DEBUG)
Copyright (c) The PHP Group
Zend Engine v4.2.12, Copyright (c) Zend Technologies
    with Zend OPcache v8.2.12, Copyright (c), by Zend Technologies
@allsilaevex
Copy link
Author

I would like to add information. This seems to repeat only with jit enabled, like this:

opcache.jit = 1215
opcache.jit_buffer_size = 128M

@matyhtf
Copy link
Member

matyhtf commented Nov 21, 2023

This is probably a bug of opcache jit. There is nothing we can do. It is recommended to submit it to php-src. We hope that the php team can solve this issue.

@matyhtf matyhtf closed this as completed Nov 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants