php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #81612 Segmentation fault on PHP 8.1 with pcov
Submitted: 2021-11-11 14:18 UTC Modified: 2021-11-21 12:02 UTC
From: bartos dot developer152 at gmail dot com Assigned: patrickallaert (profile)
Status: Closed Package: Reproducible crash
PHP Version: 8.1Git-2021-11-11 (Git) OS: Ubuntu 20.04.3
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: bartos dot developer152 at gmail dot com
New email:
PHP Version: OS:

 

 [2021-11-11 14:18 UTC] bartos dot developer152 at gmail dot com
Description:
------------
I started to test my packages with PHP 8.1 and ran into segfault issues.

I am sorry for not providing gdb backtrace, I don't really know how to do it properly. My standard way of executing tests is:

git clone ...
composer install
make tests

Failed Github Actions runs:
https://github.com/orisai/nette-console/runs/4178441932?check_suite_focus=true
https://github.com/orisai/nette-monolog/runs/4178461063?check_suite_focus=true
https://github.com/orisai/localization/runs/4149714489?check_suite_focus=true
https://github.com/orisai/data-sources/runs/4136306913?check_suite_focus=true


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2021-11-11 15:25 UTC] cmb@php.net
> I am sorry for not providing gdb backtrace, I don't really know
> how to do it properly.

See <https://bugs.php.net/bugs-generating-backtrace.php>.
 [2021-11-11 20:09 UTC] bartos dot developer152 at gmail dot com
cmb@php.net: That's exactly the page I was following. Still don't understand what I should do differently 
https://github.com/orisai/nette-console/commit/6a903996a84b3597455007938181a993d942c4df#diff-944291df2c9c06359d37cc8833d182d705c9e8c3108e7cfe132d61a06e9133ddR355-R358
 [2021-11-12 01:13 UTC] Danack at basereality dot com
In CI, I think you need to run gdb in batch mode e.g. like:

gdb -batch -ex "run" -ex "bt" --args /usr/bin/make coverage-clover

as that queues up the run and backtrace command.
 [2021-11-12 09:41 UTC] nikic@php.net
I wasn't able to reproduce this locally (using nette-console). I used this command:

~/php/php-8.1/sapi/cli/php vendor/bin/paratest -c tools/phpunit.xml --runner=WrapperRunner -p32

Not seeing any warnings under valgrind either.
 [2021-11-12 10:55 UTC] bartos dot developer152 at gmail dot com
Danack at basereality dot com:
Thank you it seems to work now. Unfortunately it added only this to output

> [Inferior 1 (process 3171) exited with code 02]
> No stack.

https://github.com/orisai/nette-console/runs/4188618661?check_suite_focus=true#step:13:117


nikic@php.net:
My full command was this, hopefully it will be helpful
XDEBUG_MODE=off php -d pcov.enabled=1 -d pcov.directory=./src "vendor/bin/paratest" -c tools/phpunit.xml --runner=WrapperRunner -p16 --coverage-clover=var/coverage/clover.xml
 [2021-11-12 11:01 UTC] nikic@php.net
Would it be possible to test with pcov not enabled? Looking at the bug tracker there, https://github.com/krakjoe/pcov/issues/73 seems to indicate that there may be a compatibility issue between pcov and PHP 8.1.
 [2021-11-12 11:05 UTC] bartos dot developer152 at gmail dot com
nikic@php.net:
That's it! Thank you, I had no idea it could be caused by pcov.
https://github.com/orisai/nette-console/runs/4188901103?check_suite_focus=true#step:13:99
 [2021-11-12 11:16 UTC] nikic@php.net
Testing with pcov now, I see this valgrind warning:

==1363300== Invalid read of size 4
==1363300==    at 0x8535BA: zend_string_release (zend_string.h:319)
==1363300==    by 0x853AB4: zm_deactivate_filestat (filestat.c:91)
==1363300==    by 0x828BFB: zm_deactivate_basic (basic_functions.c:541)
==1363300==    by 0xA3AF67: zend_deactivate_modules (zend_API.c:3016)
==1363300==    by 0x98B198: php_request_shutdown (main.c:1823)
==1363300==    by 0xB9FE2A: do_cli (php_cli.c:1135)
==1363300==    by 0xBA06FF: main (php_cli.c:1367)
==1363300==  Address 0xbc7b2b4 is 4 bytes inside a block of size 91 free'd
==1363300==    at 0x483CA3F: free (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==1363300==    by 0x66632B: php_pcov_filename_dtor (pcov.c:345)
==1363300==    by 0xA47E82: zend_hash_destroy (zend_hash.c:1590)
==1363300==    by 0x666952: zm_deactivate_pcov (pcov.c:493)
==1363300==    by 0xA3AF67: zend_deactivate_modules (zend_API.c:3016)
==1363300==    by 0x98B198: php_request_shutdown (main.c:1823)
==1363300==    by 0xB9FE2A: do_cli (php_cli.c:1135)
==1363300==    by 0xBA06FF: main (php_cli.c:1367)
==1363300==  Block was alloc'd at
==1363300==    at 0x483DD99: calloc (in /usr/lib/x86_64-linux-gnu/valgrind/vgpreload_memcheck-amd64-linux.so)
==1363300==    by 0x665E91: php_pcov_interned_string (pcov.c:210)
==1363300==    by 0x665F21: php_pcov_create (pcov.c:232)
==1363300==    by 0x6660D1: php_pcov_trace (pcov.c:270)
==1363300==    by 0x66625D: php_pcov_execute_ex (pcov.c:323)
==1363300==    by 0xA6B99A: ZEND_DO_FCALL_SPEC_RETVAL_UNUSED_HANDLER (zend_vm_execute.h:1728)
==1363300==    by 0xAE4218: zend_vm_call_opcode_handler (zend_vm_execute.h:62999)
==1363300==    by 0x666117: php_pcov_trace (pcov.c:282)
==1363300==    by 0x66625D: php_pcov_execute_ex (pcov.c:323)
==1363300==    by 0xA6BDE1: ZEND_DO_FCALL_SPEC_RETVAL_USED_HANDLER (zend_vm_execute.h:1837)
==1363300==    by 0xAE4218: zend_vm_call_opcode_handler (zend_vm_execute.h:62999)
==1363300==    by 0x666117: php_pcov_trace (pcov.c:282)
 [2021-11-12 11:44 UTC] nikic@php.net
-Summary: Segmentation fault on PHP 8.1 +Summary: Segmentation fault on PHP 8.1 with pcov
 [2021-11-12 11:44 UTC] nikic@php.net
https://github.com/krakjoe/pcov/pull/75 fixes the issue for me.
 [2021-11-21 12:02 UTC] patrickallaert@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: patrickallaert
 [2021-11-21 12:02 UTC] patrickallaert@php.net
This is a pcov bug, not a PHP one.
It has been fixed in pcov.
Thanks for your report.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Mar 29 00:01:28 2024 UTC