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

Segfault on PHP 8.1 and following #316

Open
hschimpf opened this issue Jul 9, 2024 · 3 comments
Open

Segfault on PHP 8.1 and following #316

hschimpf opened this issue Jul 9, 2024 · 3 comments

Comments

@hschimpf
Copy link

hschimpf commented Jul 9, 2024

I made a library around ext-parallel. On PHP 8.0 everything works fine, but from PHP 8.1+ I got segmentation fault errors.

Branch: https://github.com/hschimpf/parallel-sdk/tree/segfault

Run make to execute the tests on PHP 8.0

  • Expected: Normal execution
  • Actual result: process runs normally
  • Output:
     *** cropped for brevity ***
(gdb) run
Starting program: /usr/local/bin/php vendor/bin/phpunit
warning: Error disabling address space randomization: Operation not permitted
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[Detaching after vfork from child process 23]
PHPUnit 9.6.19 by Sebastian Bergmann and contributors.

.[New Thread 0x7ff9bebff700 (LWP 25)]
[New Thread 0x7ff9bdfff700 (LWP 26)]
..[New Thread 0x7ff9bd3ff700 (LWP 27)]
[New Thread 0x7ff9affff700 (LWP 28)]
. 0 of 52: Starting...
[>-------------------------------------------------------------------------------]   0%
elapsed: < 1 sec, remaining: < 1 sec, ?? items/s
memory: ??
[New Thread 0x7ff9af7fe700 (LWP 29)]
[New Thread 0x7ff9aeffd700 (LWP 30)]
[New Thread 0x7ff9ae7fc700 (LWP 31)]
[New Thread 0x7ff9adffb700 (LWP 32)]
[New Thread 0x7ff9ad3ff700 (LWP 33)]
[New Thread 0x7ff997fff700 (LWP 34)]
[New Thread 0x7ff9977fe700 (LWP 35)]
52 of 52: AnotherWorker >> I finished waiting 86ms from task #223!
[================================================================================] 100%
elapsed: < 1 sec, remaining: < 1 sec, ~51.00 items/s
memory: 551 KiB, threads: 12x ~428 KiB, Σ 5.0 MiB ↑ 5.0 MiB
.Task result from #HDSSolutions\Console\Tests\Workers\TestWorker => 6400
Task result from #HDSSolutions\Console\Tests\Workers\TestWorker => 6464
Task result from #HDSSolutions\Console\Tests\Workers\TestWorker => 6528
     *** cropped for brevity ***
Task result from #HDSSolutions\Console\Tests\Workers\AnotherWorker => 14272
Task result from #HDSSolutions\Console\Tests\Workers\AnotherWorker => 14336
Task result from #HDSSolutions\Console\Tests\Workers\AnotherWorker => 14400
..[New Thread 0x7ff97b7fe700 (LWP 41)]
[New Thread 0x7ff97a7fc700 (LWP 43)]
[New Thread 0x7ff979ffb700 (LWP 44)]
     *** cropped for brevity ***
[New Thread 0x7ff8623ff700 (LWP 106)]
[New Thread 0x7ff8617ff700 (LWP 107)]
[New Thread 0x7ff860bff700 (LWP 108)]
..                                                           9 / 9 (100%)

Time: 00:04.484, Memory: 4.00 MB

OK (9 tests, 39 assertions)
[Thread 0x7ff9bdfff700 (LWP 26) exited]
[Thread 0x7ff9bd3ff700 (LWP 27) exited]
[Thread 0x7ff9727fc700 (LWP 50) exited]
     *** cropped for brevity ***
[Thread 0x7ff995ffb700 (LWP 38) exited]
[Thread 0x7ff9953ff700 (LWP 39) exited]
[Thread 0x7ff9bebff700 (LWP 25) exited]
--Type <RET> for more, q to quit, c to continue without paging--
[Inferior 1 (process 19) exited normally]

Run make PHP=8.1 to execute the tests on PHP 8.1, 8.2 or 8.3

  • Expected: Normal execution
  • Actual result: Signal SIGSEGV, Segmentation fault
  • Output:
     *** cropped for brevity ***
(gdb) run
Starting program: /usr/local/bin/php vendor/bin/phpunit
warning: Error disabling address space randomization: Operation not permitted
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[Detaching after vfork from child process 23]
PHPUnit 9.6.19 by Sebastian Bergmann and contributors.

.[New Thread 0x7f14ce7ff6c0 (LWP 25)]
[New Thread 0x7f14cdbff6c0 (LWP 26)]
..[New Thread 0x7f14ccfff6c0 (LWP 27)]
[New Thread 0x7f14bffff6c0 (LWP 28)]
. 0 of 52: Starting...
[>-------------------------------------------------------------------------------]   0%
elapsed: < 1 sec, remaining: < 1 sec, ?? items/s
memory: ??
[New Thread 0x7f14bf7fe6c0 (LWP 29)]
[New Thread 0x7f14beffd6c0 (LWP 30)]
[New Thread 0x7f14be3ff6c0 (LWP 31)]
[New Thread 0x7f14bd7ff6c0 (LWP 32)]
[New Thread 0x7f14bcbff6c0 (LWP 33)]
[New Thread 0x7f14a7fff6c0 (LWP 34)]
[New Thread 0x7f14a73ff6c0 (LWP 35)]
[New Thread 0x7f14a67ff6c0 (LWP 36)]
[New Thread 0x7f14a5bff6c0 (LWP 37)]
[New Thread 0x7f14a4fff6c0 (LWP 38)]
[New Thread 0x7f148bfff6c0 (LWP 39)]

Thread 13 "php" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7f14a67ff6c0 (LWP 36)]
0x0000559d5814bf05 in object_init_ex ()
(gdb) bt
#0  0x0000559d5814bf05 in object_init_ex ()
#1  0x0000559d58185f44 in ?? ()
#2  0x0000559d581b09ca in execute_ex ()
#3  0x00007f14cf6d1b32 in php_parallel_scheduler_run (frame=frame@entry=0x7f14a5c14020, runtime=0x7f14cdc79960) at /tmp/pear/temp/parallel/src/scheduler.c:316
#4  0x00007f14cf6d20df in php_parallel_thread (arg=0x7f14cdc79960) at /tmp/pear/temp/parallel/src/scheduler.c:486
#5  0x00007f14d245c134 in ?? () from /lib/x86_64-linux-gnu/libc.so.6
#6  0x00007f14d24dba40 in clone () from /lib/x86_64-linux-gnu/libc.so.6
@realFlowControl
Copy link
Collaborator

realFlowControl commented Jul 10, 2024

Hey there,
thanks for making a reproducer, that helps. The good news is that in the latest develop branch that segfault is fixed, but you get a zend_mm_heap corrupted instead at the end 😉
I'll try to hunt that down and report back!

@realFlowControl
Copy link
Collaborator

Hey @hschimpf,
I am still trying to fully understand the problem and I'd like to ask you for a favour. Could you:

  • install parallel from latest develop branch
  • and try running again with and without OPcache enabled?

Please note, that enabling OPcache on CLI requires you to set the opcache.enable_cli INI setting to 1, as it is default disabled.

@realFlowControl
Copy link
Collaborator

Reason is that I think it could be the same root cause as in #309

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