Shippable / support

Shippable SaaS customers can report issues and feature requests in this repository
101 stars 28 forks source link

Segfault on first build in matrix #2488

Closed TomK closed 8 years ago

TomK commented 8 years ago

Please see https://app.shippable.com/runs/5703bef51c51560c004f746f The tests all pass but phpunit segfaults when creating the coverage xml.

Generating code coverage report in PHPUnit XML format .../root/f0237823-c9c9-4112-8655-ad6e1cd086e3.sh: line 58:  1059 Segmentation fault      (core dumped)
vendor/phpunit/phpunit/phpunit --log-junit shippable/testresults/junit.xml --coverage-xml shippable/codecoverage -c phpunit.xml
a-murphy commented 8 years ago

It looks like some segmentation faults were fixed in Xdebug 2.4.0, so that might be worth trying.

TomK commented 8 years ago

thanks @a-murphy, any idea how i should get shippable to upgrade xdebug?

a-murphy commented 8 years ago

I've found a way to install the new version of Xdebug in the build script, and hopefully someone else can find a better way. It should at least work well enough to figure out if it's related to your problem.

Adding the following to the ci section (after composer install) in shippable.yml results in PHPUnit using Xdebug 2.4.0:

    - wget https://xdebug.org/files/xdebug-2.4.0.tgz
    - tar -xvzf xdebug-2.4.0.tgz
    - cd xdebug-2.4.0
    - phpize
    - ./configure
    - make
    - if [ "$SHIPPABLE_PHP_VERSION" == 5.4 ]; then cp modules/xdebug.so /root/.phpenv/versions/5.4/lib/php/extensions/no-debug-non-zts-20100525; fi
    - if [ "$SHIPPABLE_PHP_VERSION" == 5.5 ]; then cp modules/xdebug.so /root/.phpenv/versions/5.5/lib/php/extensions/no-debug-non-zts-20121212; fi
    - if [ "$SHIPPABLE_PHP_VERSION" == 5.6 ]; then cp modules/xdebug.so /root/.phpenv/versions/5.6/lib/php/extensions/no-debug-non-zts-20131226; fi
    - if [ "$SHIPPABLE_PHP_VERSION" == 7.0 ]; then cp modules/xdebug.so /root/.phpenv/versions/7.0/lib/php/extensions/no-debug-non-zts-20151012; fi
    - cd ..

It's downloading Xdebug 2.4.0, compiling it, and copying it into the location of the existing Xdebug in the current default PHP image for a version of PHP.

TomK commented 8 years ago

upgraded to xdebug 2.4.0 and still getting a segfault. https://app.shippable.com/runs/5704cce31c51560c006ce773

vendor/phpunit/phpunit/phpunit --log-junit shippable/testresults/junit.xml --coverage-xml shippable/codecoverage -c phpunit.xml  
PHPUnit 4.8.24 by Sebastian Bergmann and contributors.

Runtime:    PHP 5.6.7 with Xdebug 2.4.0
Configuration:  /root/src/github.com/packaged/queue/phpunit.xml

......

Time: 23.02 seconds, Memory: 11.75Mb

OK (6 tests, 10 assertions)

Generating code coverage report in PHPUnit XML format .../root/bd357b76-814e-46ac-a876-4f5e535ce463.sh: line 58:  5558 Segmentation fault      (core dumped) vendor/phpunit/phpunit/phpunit --log-junit shippable/testresults/junit.xml --coverage-xml shippable/codecoverage -c phpunit.xml

My yaml file:

language: php

services:
  - rabbitmq

php:
  - 5.6
  - 7.0
  - hhvm

build:
  ci:
    - if [ "$SHIPPABLE_PHP_VERSION" == 5.6 ]; then
        wget https://xdebug.org/files/xdebug-2.4.0.tgz;
        tar -xvzf xdebug-2.4.0.tgz;
        cd xdebug-2.4.0;
        phpize;
        ./configure;
        make;
        make install;
        cd -;
      fi
    - composer self-update
    - composer install --no-progress --no-interaction --prefer-source
    - vendor/phpunit/phpunit/phpunit --log-junit shippable/testresults/junit.xml --coverage-xml shippable/codecoverage -c phpunit.xml
a-murphy commented 8 years ago

Since the segmentation fault is probably related to PHP in some way, and you're only seeing it for 5.6, you could try a more recent version of PHP 5.6. The currently-installed version for 5.6 is 5.6.7.

This will install 5.6.18, tell phpenv to use it, and install Composer for 5.6.18:

    -  if [ "$SHIPPABLE_PHP_VERSION" == 5.6 ]; then
        /usr/local/bin/phpenv-install 5.6.18;
        'eval "$(phpenv init -)"';
        $HOME/.phpenv/bin/phpenv global 5.6.18;
        php --version;
        curl -s http://getcomposer.org/installer | php;
        chmod +x composer.phar;
        mv composer.phar $HOME/.phpenv/versions/5.6.18/bin/composer;
        fi;
manishas commented 8 years ago

@TomK please let us know if Aidan's suggestion above works for you.

TomK commented 8 years ago

Hi, unfortunately i get the same result on PHP 5.6.18 with Xdebug 2.3.3:

  vendor/phpunit/phpunit/phpunit --log-junit shippable/testresults/junit.xml --coverage-xml shippable/codecoverage -c phpunit.xml  
PHPUnit 4.8.24 by Sebastian Bergmann and contributors.

Runtime:    PHP 5.6.18 with Xdebug 2.3.3
Configuration:  /root/src/github.com/packaged/queue/phpunit.xml

......

Time: 24.7 seconds, Memory: 11.75Mb

OK (6 tests, 10 assertions)

Generating code coverage report in PHPUnit XML format .../root/2c127f11-5c0d-44e3-8361-884d89a4a75d.sh: line 58:  4271 Segmentation fault      (core dumped) vendor/phpunit/phpunit/phpunit --log-junit shippable/testresults/junit.xml --coverage-xml shippable/codecoverage -c phpunit.xml
TomK commented 8 years ago

I've added php55 to the matrix just to see. php55 is segfaulting as well as php56

TomK commented 8 years ago

Just so you know, i have resolved this by disabling garbage collection (-dzend.enable_gc=0) when running phpunit.

vendor/phpunit/phpunit/phpunit -dzend.enable_gc=0 --log-junit shippable/testresults/junit.xml --coverage-xml shippable/codecoverage -c phpunit.xml

manishas commented 8 years ago

Closing this issue since it is resolved.