View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0001246 | Xdebug | Uncategorized | public | 2016-01-11 15:32 | 2016-06-06 21:25 |
Reporter | rsmith@golumigent.com | Assigned To | derick | ||
Priority | normal | Severity | crash | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Platform | Linux | OS | CentOS | OS Version | 7 |
Product Version | 2.4.0rc3 | ||||
Fixed in Version | 2.4.1 | ||||
Summary | 0001246: Seg fault when running PHPUnit with code coverage | ||||
Description | I have PHP 7.0.2 installed and when running PHPUnit (v4.8.21) with code coverage, I get a segmentation fault. As soon as I run without code coverage, the tests run fine. | ||||
Steps To Reproduce | PHP 7.0.2 installed with: ./configure --with-apxs2=/usr/bin/apxs \ XDebug extension enabled "zend_extension=xdebug.so" | ||||
Tags | No tags attached. | ||||
Attached Files | gdb_run.txt (1,663 bytes)
[vagrant@papi papi-app]$ gdb --args php vendor/bin/phpunit --colors --verbose --configuration tests/unit/phpunit.xml --log-junit="tests/unit/report.xml" --coverage-html="tests/unit/reports/coverage" --testdox-html="tests/unit/reports/testdox/index.html" --filter shouldGenerateBaseCoreOutput GNU gdb (GDB) Red Hat Enterprise Linux (7.2-83.el6) Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "x86_64-redhat-linux-gnu". For bug reporting instructions, please see: <http://www.gnu.org/software/gdb/bugs/>... Reading symbols from /usr/bin/php...(no debugging symbols found)...done. Missing separate debuginfos, use: debuginfo-install php70w-cli-7.0.5-1.w6.x86_64 (gdb) r Starting program: /usr/bin/php vendor/bin/phpunit --colors --verbose --configuration tests/unit/phpunit.xml --log-junit=tests/unit/report.xml --coverage-html=tests/unit/reports/coverage --testdox-html=tests/unit/reports/testdox/index.html --filter shouldGenerateBaseCoreOutput [Thread debugging using libthread_db enabled] PHPUnit 4.1.6 by Sebastian Bergmann. Configuration read from /etc/alternatives/papi-app/tests/unit/phpunit.xml Program received signal SIGSEGV, Segmentation fault. 0x00007fffedd13373 in xdebug_build_fname_from_oparray (tmp=0x7fffffff9000, opa=0x7fffe558b2a0) at /home/vagrant/xdebug-2.4.0/xdebug_code_coverage.c:812 812 if (strcmp(STR_NAME_VAL(opa->function_name), "{closure}") == 0) { | ||||
Operating System | CentOS 7.0.2 | ||||
PHP Version | 7.0.0-7.0.4 | ||||
|
Could you please try Xdebug from github's master branch? I fixed a few things. If that doesn't fix it, I will need to have a nice backtrace (hints on how to make them: https://bugs.php.net/bugs-generating-backtrace.php) |
|
I cloned the repo and am using RC4-dev, but I still get the segfault. I'll work on trying to get a backtrace to you tomorrow; I've never done it so thanks for the doc. |
|
That's all right. The easiest is probably to run your example with this: gdb --args php and then type "run" For this to work, you do need debugging symbols in PHP enabled - possible by installing the php7-dev or php7-devel packages if you use PHP 7 from a repository. If you compiled it yourself, make sure you have --enable-debug in PHP's configure line. Ping me on IRC (FreeNode/#xdebug) if you want tomorrow. I'm on GMT. |
|
zaq178miami, your issue is described in 0001239 - please note that this bug was for PHP 7.0.X, whereas yours is specifically for PHP 7.1.X. I've copied our comments over, and will delete them from this report, as they are unrelated. |
|
derick, here is the output from gdb: [root@localhost ryan]# gdb php core-php.18294 And then the backtrace: #0 0x00007f270886174b in xdebug_set_in_ex (set=0x2904260, position=4294966624, noisy=1) at /home/ryan/xdebug/xdebug_set.c:72 |
|
This is may be the same issue as 0001257, since phpunit uses XDEBUG_CC_UNUSED | XDEBUG_CC_DEAD_CODE as options to xdebug_start_code_coverage |
|
Another full trace, when running on Travis-CI |
|
I am reasonably certain this is now fixed in 2.4.0RC4 - Can you please try this? |
|
I just downloaded and enabled 2.4.0RC4 and still received the seg_fault. |
|
Haven't tried on 7.0.3, but RC4 did not fix it on 7.0.2 on Travis. |
|
Thanks rsmith. Can you make another backtrace like you did before, but then also add the following things. Find the frame number of the lowest xdebug_analyse_branch call (#1 in your example). Run at the GDB prompt (change the number to what you found): Also find the first "prefill_from_oparray" number, and provide me with the file it references (in the original GDB output from above, /home/ryan/projects/ips/1/vendor/phpunit/phpunit/src/Util/XML.php) cheers, |
|
Ping? |
|
Sorry, this happens on my work VM and don't really have the time while I'm at work to get a backtrace. If I get a free moment, I will get you the backtrace. At this point, I'm continuing to just disable the extension to run PHPUnit tests. |
|
@derick - I think the information you're looking for is available in the trace I provided, even though the trace was not captured interactively. |
|
@interfaSys - Do you have opcache enabled? Can you try disabling it to see if it changes things? |
|
Spot on. Opcache is enabled on Travis, even though it's not mentioned anywhere in their documentation. Generating coverage does break some tests though (error 500), so I'll have to see why this is happening and if it is linked to xdebug. And there is also an issue with the total line count. |
|
@derick, opcache was enabled for me as well. Disabling it allowed me to run my tests with coverage as expected. Is XDebug incompatible with opcache? |
|
PHP 7.0.4 (cli) (built: Mar 5 2016 00:55:49) ( NTS ) After method But without XDEBUG_CC_UNUSED it's OK. |
|
As a temporary solution i set ini_set('opcache.optimization_level', '0x00000000'); |
|
I am experiencing a similar problem for a unit test that uses Mockery with the "shouldIgnoreMissing()" feature set. It seems that there is an issue with running code coverage on some eval()'ed code. I'm working to reproduce the problem with a small example. For the time being, I've ascertained that the segfault is occurring on line 812 in xdebug_code_coverage.c (https://github.com/xdebug/xdebug/blob/140bbcd5cb57065f5885afb93397f006ad7e183e/xdebug_code_coverage.c#L812), according to my last gdb run, the output of which I will attach here. Please let me know how I can be of further assistance. |
|
I reproduced this issue while investigating segmentation fault of PHP builtin http server. index.php php -S 127.0.0.1:8001 Server crashes on the second request: Output: Segmentation fault (core dumped) |
|
Thanks, Naktibalda - I can reproduce your segfault without opcache enabled. |
|
Naktibalda, I fixed your issue in GIT now. Can everybody else try with the latest from GIT master as well please? |
|
Derick, thank you. I can confirm that it solved my issue. |
|
It solved onedev_link's issue too. |
|
OK. Closing it then, and marking it as fixed for 2.4.1. |
Date Modified | Username | Field | Change |
---|---|---|---|
2016-01-11 15:32 | rsmith@golumigent.com | New Issue | |
2016-01-11 22:13 | derick | Note Added: 0003395 | |
2016-01-11 22:13 | derick | Assigned To | => derick |
2016-01-11 22:13 | derick | Status | new => feedback |
2016-01-11 22:25 | rsmith@golumigent.com | Note Added: 0003398 | |
2016-01-11 22:25 | rsmith@golumigent.com | Status | feedback => assigned |
2016-01-11 22:47 | derick | Note Added: 0003400 | |
2016-01-12 09:08 | derick | Note Added: 0003410 | |
2016-01-12 14:35 | rsmith@golumigent.com | Note Added: 0003415 | |
2016-01-20 16:37 | driusan | Note Added: 0003429 | |
2016-01-22 11:26 | interfaSys | Note Added: 0003432 | |
2016-02-08 21:04 | derick | Note Added: 0003452 | |
2016-02-08 21:04 | derick | Status | assigned => feedback |
2016-02-08 21:38 | rsmith@golumigent.com | Note Added: 0003462 | |
2016-02-08 21:38 | rsmith@golumigent.com | Status | feedback => assigned |
2016-02-08 21:50 | interfaSys | Note Added: 0003463 | |
2016-02-08 22:00 | derick | Note Added: 0003464 | |
2016-02-08 22:00 | derick | Status | assigned => feedback |
2016-02-27 15:59 | derick | Note Added: 0003525 | |
2016-02-29 13:20 | rsmith@golumigent.com | Note Added: 0003536 | |
2016-02-29 13:20 | rsmith@golumigent.com | Status | feedback => assigned |
2016-02-29 17:35 | interfaSys | Note Added: 0003537 | |
2016-02-29 17:35 | interfaSys | Note Edited: 0003537 | |
2016-03-04 15:38 | derick | Note Added: 0003543 | |
2016-03-05 19:40 | interfaSys | Note Added: 0003562 | |
2016-03-07 13:52 | rsmith@golumigent.com | Note Added: 0003565 | |
2016-03-24 10:45 | onedev_link | Note Added: 0003573 | |
2016-04-22 11:00 | onedev_link | Note Added: 0003585 | |
2016-04-25 16:27 | mkaminski | Note Added: 0003587 | |
2016-04-25 16:28 | mkaminski | File Added: gdb_run.txt | |
2016-05-26 20:18 | Naktibalda | Note Added: 0003609 | |
2016-05-26 20:20 | Naktibalda | Note Edited: 0003609 | |
2016-05-26 20:24 | derick | Note Added: 0003610 | |
2016-05-29 08:09 | derick | Note Added: 0003615 | |
2016-06-04 22:30 | Naktibalda | Note Added: 0003624 | |
2016-06-04 22:35 | Naktibalda | Note Added: 0003625 | |
2016-06-06 21:25 | derick | Note Added: 0003627 | |
2016-06-06 21:25 | derick | Status | assigned => closed |
2016-06-06 21:25 | derick | Resolution | open => fixed |
2016-06-06 21:25 | derick | Fixed in Version | => 2.4.1 |
2016-07-31 12:36 | derick | Category | Usage problems => Usage problems (Crashes) |
2016-07-31 12:38 | derick | Category | Usage problems (Crashes) => Usage problems (Wrong Results) |
2020-03-12 16:35 | derick | Category | Usage problems (Wrong Results) => Variable Display |
2020-03-12 16:38 | derick | Category | Variable Display => Uncategorized |