Bug #70805 [Com]: Segmentation faults whilst running Drupal 8 test suite

From: Date: Thu, 29 Oct 2015 16:52:39 +0000
Subject: Bug #70805 [Com]: Segmentation faults whilst running Drupal 8 test suite
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-196880@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=70805&edit=1

 ID:                 70805
 Comment by:         neclimdul at gmail dot com
 Reported by:        alex dot a dot pott at gmail dot com
 Summary:            Segmentation faults whilst running Drupal 8 test
                     suite
 Status:             Feedback
 Type:               Bug
 Package:            Reproducible crash
 Operating System:   OS X & Linux
 PHP Version:        7.0.0RC5
 Block user comment: N
 Private report:     N

 New Comment:

Sounds like the web user doesn't have access to your sites directory. Changing that should fix
the error.


Previous Comments:
------------------------------------------------------------------------
[2015-10-29 16:32:34] ab@php.net

Were it possible to extract a reproduce case? I currently have a trouble reproducing it as the test
fails to execute:

An AJAX HTTP error occurred.
HTTP Result Code: 500
Debugging information follows.
Path: /drupal-8.0.0-rc2/index.php/batch?id=6&op=do_nojs&op=do
StatusText: Internal Server Error
ResponseText: {"message":"A fatal error occurred: SQLSTATE[HY000]: General error: 14
unable to open database: sites\/default\/files\/.ht.sqlite-simpletest813778: ATTACH DATABASE
:database AS :prefix; Array\n(\n    [:database] =\u003E
sites\/default\/files\/.ht.sqlite-simpletest813778\n    [:prefix] =\u003E
simpletest813778\n)\n"}

Or maybe you have a tip how to overrule it?

Thanks.

------------------------------------------------------------------------
[2015-10-28 18:03:10] fabian at tag1consulting dot com

A simple gc_collect_cycles() before the affected code also "solves" the problem.

------------------------------------------------------------------------
[2015-10-28 17:57:17] fabian at tag1consulting dot com

I just confirmed that this is a GC problem:

a) The graph implementation, which is really simple leaks memory - so directed references are not
resolved correctly.

b) Disabling the GC via disable_gc() during the graph operation fixes the segfault.

I assume this is just happening very late in a process, because we first garbage collect wrongly, so
memory is leaked and then we suddenly garbage collect _during_ the graph creation and that wracks
havoc, which also means the backtrace makes sense.

------------------------------------------------------------------------
[2015-10-28 15:01:13] neclimdul at gmail dot com

The exact line trigging this is _really_ deep which is making it hard to simplify. I've tried a
couple things but haven't made headway.

The code is in Symfony and is making a graph of services. The exact line on the test I was looking
at was:

<?php
    public function addOutEdge(ServiceReferenceGraphEdge $edge)
    {
        $this->outEdges[] = $edge;
    }
?>

I can setup a test environment and give someone access if they want to step through the failure.

------------------------------------------------------------------------
[2015-10-28 13:07:23] alex dot a dot pott at gmail dot com

Description:
------------
When running certain Drupal 8 tests on PHP7 we get a segmentation fault. This does not occur on
PHP5.*

* thread #1: tid = 0x0000, 0x00000001055c6264 php`_emalloc_56 + 36 at zend_alloc.c:1291, stop reason
= signal SIGSTOP
    frame #0: 0x00000001055c6264 php`_emalloc_56 + 36 at zend_alloc.c:1291
   1288
   1289		if (EXPECTED(heap->free_slot[bin_num] != NULL)) {
   1290			zend_mm_free_slot *p = heap->free_slot[bin_num];
-> 1291			heap->free_slot[bin_num] = p->next_free_slot;
   1292			return (void*)p;
   1293		} else {
   1294			return zend_mm_alloc_small_slow(heap, bin_num ZEND_FILE_LINE_RELAY_CC
ZEND_FILE_LINE_ORIG_RELAY_CC);


  * frame #0: 0x00000001055c6264 php`_emalloc_56 + 36 at zend_alloc.c:1291
    frame #1: 0x00000001055c6240 php`_emalloc_56 + 16 at zend_alloc.c:2361
    frame #2: 0x0000000105601f36 php`zend_array_dup(source=0x0000000106d208c0) + 22 at
zend_hash.c:1716
    frame #3: 0x000000010566b840
php`ZEND_ASSIGN_DIM_SPEC_VAR_UNUSED_HANDLER(execute_data=0x000000010681aee0) + 112 at
zend_vm_execute.h:18975
    frame #4: 0x0000000105630298 php`execute_ex(ex=<unavailable>) + 40 at
zend_vm_execute.h:417
    frame #5: 0x00000001056306be php`zend_execute(op_array=<unavailable>,
return_value=<unavailable>) + 1038 at zend_vm_execute.h:458
    frame #6: 0x00000001055ef3ab php`zend_execute_scripts(type=8, retval=0x0000000000000000,
file_count=3) + 315 at zend.c:1428
    frame #7: 0x000000010558b7f4 php`php_execute_script(primary_file=0x00007fff5a9f82b0) + 852 at
main.c:2471
    frame #8: 0x0000000105682b60 php`do_cli(argc=<unavailable>, argv=<unavailable>) +
4048 at php_cli.c:974
    frame #9: 0x0000000105681a17 php`main(argc=<unavailable>, argv=<unavailable>) + 1399
at php_cli.c:1345
    frame #10: 0x00007fff8a9e65c9 libdyld.dylib`start + 1

Test script:
---------------
1. Install Drupal 8 from https://www.drupal.org/node/3060 (you will need a lamp
stack or equivalent)
2. create the directory sites/simpletest
3. Enable the simpletest module once you have installed Drupal 8 (http://YOURSITE/admin/modules)
4a. Run the BasicAuthTest test from http://YOURSITE/admin/config/development/testing
OR
4b. Run from the command line using php ./core/scripts/run-tests.sh --color --non-html --url http://YOURSITE/ --verbose --class
'Drupal\basic_auth\Tests\Authentication\BasicAuthTest'




------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=70805&edit=1


Thread (23 messages)

« previous php.bugs (#196880) next »