View Issue Details

IDProjectCategoryView StatusLast Update
0001233XdebugUncategorizedpublic2016-11-22 23:28
Reporterallansun Assigned Toderick  
PrioritynormalSeveritycrashReproducibilityalways
Status closedResolutionfixed 
PlatformLinuxOSUbuntuOS Version14.04
Product Version2.4.0rc3 
Summary0001233: Segmentation fault with PHPUnit 5.1.3 (Dockerized environment)
Description

I created a docker file with latest PHP7 GA installation, PHPUnit 5.1.3 is the latest version available now.
Testing against https://github.com/sebastianbergmann/money, Segmentation fault immediately after PHPUnit started:

PHPUnit 5.1.3 by Sebastian Bergmann and contributors.

Runtime: PHP 7.0.0-5+deb.sury.org~trusty+1 with Xdebug 2.4.0RC3
Configuration: /var/www/html/build/phpunit.xml

Segmentation fault

=============
Also I'd like to point out that in the tailored installation guide, 'cd xdebug-2.4.0rc3' should be 'cd xdebug-2.4.0RC3' to avoid filename case sensitive operating systems error.

Steps To Reproduce

Create Docker file from Additional Information under /www/Dockerfile

cd /www/
git clone https://github.com/sebastianbergmann/money.git ./money
docker build -t php7docker .
docker run -it -v /www/money:/var/www/html php7docker bash
phpunit

Additional Information

FROM phusion/baseimage:latest
MAINTAINER Allan Sun <allan.sun@bricre.com>

CMD ["/sbin/my_init"]

Install base packages

ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update && \
apt-get -y upgrade && \
apt-get -y install python-software-properties language-pack-en-base
RUN LC_ALL=en_US.UTF-8 apt-add-repository ppa:ondrej/php-7.0 && \
apt-get update && \
apt-get -yq install \
locales apache2 libapache2-mod-php7.0 \
php php-cli php-mysql php-gd php-curl php-memcached \
curl vim htop wget && \
apt-get clean && \
rm -rf /var/lib/apt/lists/ /tmp/ /var/tmp/*

Add our crontab file

#ADD crons.conf /root/crons.conf

Use the crontab file

#RUN crontab /root/crons.conf

php.ini settings

RUN sed -ie 's/\;date.timezone\ \=/date.timezone\ \=\ Europe\/London/g' /etc/php/7.0/apache2/php.ini && \
sed -i "s/error_reporting = .$/error_reporting = E_ALL \& ~E_NOTICE \& ~E_STRICT \& ~E_DEPRECATED \& ~E_WARNING/" /etc/php/7.0/apache2/php.ini && \
sed -i "s/short_open_tag = Off/short_open_tag = On/" /etc/php/7.0/apache2/php.ini && \
sed -i 's/\;date.timezone\ \=/date.timezone\ \=\ Europe\/London/g' /etc/php/7.0/cli/php.ini && \
sed -i "s/error_reporting = .
$/error_reporting = E_ALL \& ~E_NOTICE \& ~E_STRICT \& ~E_DEPRECATED \& ~E_WARNING/" /etc/php/7.0/cli/php.ini && \
sed -i "s/short_open_tag = Off/short_open_tag = On/" /etc/php/7.0/cli/php.ini &&\

# Install misc libs needed
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer && \
echo &quot;PATH=$PATH:/root/.composer/vendor/bin&quot; >> ~/.bashrc && \
a2enmod rewrite && \
/etc/init.d/apache2 restart

Configure /app folder with sample app

ADD ApacheConfig.conf /etc/apache2/sites-enabled/000-default.conf

Add configs

ADD apache2.conf /etc/apache2/apache2.conf

Add startup scripts

RUN mkdir /etc/service/apache2
ADD run.apache.sh /etc/service/apache2/run
RUN chmod +x /etc/service/*/run
RUN APP_ENVIRONMENT=production

Set ports and workdir

EXPOSE 80
VOLUME ["/var/www/html"]
WORKDIR /var/www/html

Additional for development env

RUN apt-get update && \
apt-get -yq install \
php-pear php-dev git

Install PHPUnit

RUN composer global require "phpunit/phpunit=5.*" && \
pecl channel-update pecl.php.net

Install xDebug

RUN wget http://xdebug.org/files/xdebug-2.4.0rc3.tgz && \
tar -xvzf xdebug-2.4.0rc3.tgz && \
cd xdebug-2.4.0RC3 && \
phpize && \
./configure && \
make && \
cp modules/xdebug.so /usr/lib/php/20151012

php.ini settings

ADD php_extra.ini /etc/php/7.0/php_extra.ini

RUN ln -s /etc/php/7.0/php_extra.ini /etc/php/7.0/apache2/conf.d/99-php_extra.ini && \
ln -s /etc/php/7.0/php_extra.ini /etc/php/7.0/cli/conf.d/99-php_extra.ini

Clean apt-get cache to shrink image size

RUN apt-get clean && \
rm -rf /var/lib/apt/lists/ /tmp/ /var/tmp/*

RUN APP_ENVIRONMENT=development

TagsNo tags attached.
Attached Files
valgrind.log.zip (108,370 bytes)
Operating System
PHP Version7.0.0-7.0.4

Activities

allansun

2015-12-14 04:34

reporter   ~0003339

last step should be :
phpunit --configuration build/phpunit.xml

zak

2015-12-21 01:10

reporter   ~0003369

I have the same issue - example output from fpm process:

php_1 | [21-Dec-2015 01:00:04] WARNING: [pool www] child 15 exited on signal 11 (SIGSEGV - core dumped) after 57.204065 seconds from start
php_1 | [21-Dec-2015 01:00:04] NOTICE: [pool www] child 18 started

zak

2016-01-04 02:30

reporter   ~0003383

Last edited: 2016-01-04 02:37

An update to this issue - it still occurs with php 7.0.1 using the official php docker image as base. See https://hub.docker.com/r/spira/docker-phpfpm/~/dockerfile/

allansun

2016-01-30 18:00

reporter   ~0003436

I have updated to RC4 and the problem still exists.

Valgrind dump has been attached.

Apparently the problem occurs in CodeCoverage.

==882== Process terminating with default action of signal 11 (SIGSEGV)
==882== Access not within mapped region at address 0x445067C0
==882== at 0x7A55BBE: xdebug_set_in_ex (xdebug_set.c:72)
==882== by 0x7A488C2: xdebug_analyse_branch (xdebug_code_coverage.c:705)
==882== by 0x7A489F2: xdebug_analyse_branch (xdebug_code_coverage.c:729)
==882== by 0x7A489F2: xdebug_analyse_branch (xdebug_code_coverage.c:729)
==882== by 0x7A489F2: xdebug_analyse_branch (xdebug_code_coverage.c:729)
==882== by 0x7A48E82: xdebug_analyse_oparray (xdebug_code_coverage.c:787)
==882== by 0x7A48E82: prefill_from_oparray (xdebug_code_coverage.c:872)
==882== by 0x7A49055: prefill_from_function_table (xdebug_code_coverage.c:914)
==882== by 0x7A490BD: prefill_from_class_table (xdebug_code_coverage.c:942)
==882== by 0x72C67D: zend_hash_apply_with_arguments (in /usr/bin/php7.0)
==882== by 0x7A4A32A: xdebug_code_coverage_start_of_function (xdebug_code_coverage.c:968)
==882== by 0x7A44EF5: xdebug_execute_ex (xdebug.c:1849)
==882== by 0x70DA4B: zend_call_function (in /usr/bin/php7.0)
==882== by 0x736F43: zend_call_method (in /usr/bin/php7.0)
==882== by 0x5EAE4F: zif_spl_autoload_call (in /usr/bin/php7.0)
==882== by 0x70C22A: dtrace_execute_internal (in /usr/bin/php7.0)
==882== by 0x7A453B0: xdebug_execute_internal (xdebug.c:2025)
==882== by 0x70DEA7: zend_call_function (in /usr/bin/php7.0)
==882== by 0x70E171: zend_lookup_class_ex (in /usr/bin/php7.0)
==882== by 0x70EAB7: zend_fetch_class_by_name (in /usr/bin/php7.0)
==882== by 0x79AC53: ??? (in /usr/bin/php7.0)
==882== by 0x756E7A: execute_ex (in /usr/bin/php7.0)
==882== by 0x70C128: dtrace_execute_ex (in /usr/bin/php7.0)
==882== by 0x7A44A3E: xdebug_execute_ex (xdebug.c:1880)
==882== by 0x793EAF: ??? (in /usr/bin/php7.0)
==882== by 0x756E7A: execute_ex (in /usr/bin/php7.0)
==882== by 0x70C128: dtrace_execute_ex (in /usr/bin/php7.0)
==882== by 0x7A44A3E: xdebug_execute_ex (xdebug.c:1880)
==882== by 0x793EAF: ??? (in /usr/bin/php7.0)
==882== by 0x756E7A: execute_ex (in /usr/bin/php7.0)
==882== by 0x70C128: dtrace_execute_ex (in /usr/bin/php7.0)
==882== by 0x7A44A3E: xdebug_execute_ex (xdebug.c:1880)
==882== by 0x793EAF: ??? (in /usr/bin/php7.0)
==882== by 0x756E7A: execute_ex (in /usr/bin/php7.0)
==882== by 0x70C128: dtrace_execute_ex (in /usr/bin/php7.0)
==882== by 0x7A44A3E: xdebug_execute_ex (xdebug.c:1880)
==882== by 0x793EAF: ??? (in /usr/bin/php7.0)
==882== by 0x756E7A: execute_ex (in /usr/bin/php7.0)
==882== by 0x70C128: dtrace_execute_ex (in /usr/bin/php7.0)
==882== by 0x7A44A3E: xdebug_execute_ex (xdebug.c:1880)
==882== by 0x793EAF: ??? (in /usr/bin/php7.0)
==882== If you believe this happened as a result of a stack
==882== overflow in your program's main thread (unlikely but
==882== possible), you can try to increase the size of the
==882== main thread stack using the --main-stacksize= flag.
==882== The main thread stack size used in this run was 8388608.
==882==
==882== HEAP SUMMARY:
==882== in use at exit: 4,430,370 bytes in 77,223 blocks
==882== total heap usage: 3,452,047 allocs, 3,374,824 frees, 298,954,364 bytes allocated
==882==
==882== Searching for pointers to 77,223 not-freed blocks
==882== Checked 282,148,136 bytes

Really hope this problem can be solved in an urgent matter

derick

2016-02-08 19:49

administrator   ~0003449

I do not have docker, so I can not try it with that. Please provide a reproducible case without docker.

I can also not reproduce your problem with either 2.4.0RC3 or RC4 on PHP 7.0.2.

derick

2016-02-27 16:00

administrator   ~0003527

Can you please provide a reproducible case that does not depend on docker?

allansun

2016-02-27 16:03

reporter   ~0003532

Last edited: 2016-02-27 16:04

It is not reproducible without docker...
Currently I am using PHP5.6 & debug 2.4 on docker without any problems.
However no matter running with code coverage or not, PHP7 cannot run all my PHPUnit tests successfully, even without docker, and it randomly exits so I suppose the bug is back to PHP 7 itself.

derick

2016-03-04 20:51

administrator   ~0003557

To the docker stuff, I don't use it, and I don't to mess up my system with it either. Which means you need to do more work on this.

First of all, make sure you don't compile Xdebug in an optimised mode. This removes useful information from backtraces. The easiest way probably is to change the "-O2" in the Makefile to "-O0 -ggdb3" after you ran ./configure, and before "make". I believe it's in two locations in the Makefile.

The docker container should have additional tools installed, such as valgrind and gdb. Run the script that segfaults with the following commands on the bash shell (in the docker container). You should also install the php-debug debian package (or equivalent):

export USE_ZEND_ALLOC=0
export ZEND_DONT_UNLOAD_MODULES=0
php which phpunit --configuration build/phpunit.xml
valgrind php which phpunit --configuration build/phpunit.xml
gdb --args php which phpunit --configuration build/phpunit.xml

And then on the GDB prompt:
run

and when it crashes, type:
bt full

Please don't paste the output of all of this into the comment fields, but attach a file with all of it.

derick

2016-05-10 22:24

administrator   ~0003594

Ping?

vladas

2016-05-12 21:08

reporter   ~0003603

The problem appears to be fixed for me. Not sure though what fixed it. I updated my machine to the Ubuntu 16.04; Docker version 1.11.1, build 5604cbe; PHP Version 7.0.6-1~dotdeb+8.1 with Xdebug v2.4.0.

derick

2016-05-29 08:10

administrator   ~0003616

Allansun, is it fixed for you too?

derick

2016-11-22 23:28

administrator   ~0003780

Close as reported fixed, and no reply from original reporter.

Issue History

Date Modified Username Field Change
2015-12-14 04:32 allansun New Issue
2015-12-14 04:34 allansun Note Added: 0003339
2015-12-21 01:10 zak Note Added: 0003369
2016-01-04 02:30 zak Note Added: 0003383
2016-01-04 02:37 zak Note Edited: 0003383
2016-01-30 17:58 allansun File Added: valgrind.log.zip
2016-01-30 18:00 allansun Note Added: 0003436
2016-02-08 19:49 derick Note Added: 0003449
2016-02-08 19:49 derick Assigned To => derick
2016-02-08 19:49 derick Status new => feedback
2016-02-27 16:00 derick Note Added: 0003527
2016-02-27 16:03 allansun Note Added: 0003532
2016-02-27 16:03 allansun Status feedback => assigned
2016-02-27 16:04 allansun Note Edited: 0003532
2016-03-04 20:51 derick Note Added: 0003557
2016-03-04 20:51 derick Status assigned => feedback
2016-05-10 22:24 derick Note Added: 0003594
2016-05-12 21:08 vladas Note Added: 0003603
2016-05-29 08:10 derick Note Added: 0003616
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)
2016-11-22 23:28 derick Note Added: 0003780
2016-11-22 23:28 derick Status feedback => closed
2016-11-22 23:28 derick Resolution open => fixed
2020-03-12 16:35 derick Category Usage problems (Wrong Results) => Variable Display
2020-03-12 16:38 derick Category Variable Display => Uncategorized