|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2015-10-28 13:07 UTC] 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'
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Oct 30 22:00:01 2025 UTC |
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.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.Together with setting: #define GC_ROOT_BUFFER_MAX_ENTRIES 20001 the following script produces a segfault: A different backtrace, but it seems related so posting here, as I hope that the fix for this script might also fix this issue here. --- <?php class Foo { protected $list = []; protected function doSomething($var) { $var->ref = $this; $this->list[] = $var; } public function init() { $array = []; for ($i = 0; $i < 19000; $i++) { $array[] = new \StdClass(); } foreach ($array as $value) { $this->doSomething($value); } $this->list = []; $array = []; } } $foo = new Foo(); $foo->init(); --- Backtrace: Program terminated with signal SIGSEGV, Segmentation fault. #0 0x00000000009a3dce in gc_remove_from_roots (root=0x7f72b10e9050) at /home/ubuntu/php7/php-src/Zend/zend_gc.c:120 120 root->prev->next = root->next; Traceback (most recent call last): File "/usr/share/gdb/auto-load/usr/lib/x86_64-linux-gnu/libstdc++.so.6.0.19-gdb.py", line 63, in <module> from libstdcxx.v6.printers import register_libstdcxx_printers ImportError: No module named 'libstdcxx' (gdb) bt #0 0x00000000009a3dce in gc_remove_from_roots (root=0x7f72b10e9050) at /home/ubuntu/php7/php-src/Zend/zend_gc.c:120 #1 0x00000000009a4326 in gc_remove_from_buffer (ref=0x7f72a87d9fa0) at /home/ubuntu/php7/php-src/Zend/zend_gc.c:286 #2 0x00000000009bd0d8 in zend_objects_store_del (object=0x7f72a87d9fa0) at /home/ubuntu/php7/php-src/Zend/zend_objects_API.c:190 #3 0x000000000096f190 in _zval_dtor_func_for_ptr (p=0x7f72a87d9fa0, __zend_filename=0xfc9940 "/home/ubuntu/php7/php-src/Zend/zend_hash.c", __zend_lineno=1261) at /home/ubuntu/php7/php-src/Zend/zend_variables.c:109 #4 0x000000000098354e in i_zval_ptr_dtor (zval_ptr=0x7f72a7542fe8, __zend_filename=0xfc9940 "/home/ubuntu/php7/php-src/Zend/zend_hash.c", __zend_lineno=1261) at /home/ubuntu/php7/php-src/Zend/zend_variables.h:58 #5 0x00000000009870a8 in zend_array_destroy (ht=0x7f72a8659540) at /home/ubuntu/php7/php-src/Zend/zend_hash.c:1261 #6 0x000000000096f13a in _zval_dtor_func_for_ptr (p=0x7f72a8659540, __zend_filename=0xfcec40 "/home/ubuntu/php7/php-src/Zend/zend_execute.h", __zend_lineno=103) at /home/ubuntu/php7/php-src/Zend/zend_variables.c:96 #7 0x00000000009c4fc3 in zend_assign_to_variable (variable_ptr=0x7f72a8614150, value=0x7f72a8674410, value_type=1 '\001') at /home/ubuntu/php7/php-src/Zend/zend_execute.h:103 #8 0x0000000000a0fbfc in ZEND_ASSIGN_SPEC_CV_CONST_HANDLER () at /home/ubuntu/php7/php-src/Zend/zend_vm_execute.h:31718 #9 0x00000000009cd2ff in execute_ex (ex=0x7f72a8614030) at /home/ubuntu/php7/php-src/Zend/zend_vm_execute.h:414 #10 0x00000000009cd411 in zend_execute (op_array=0x7f72a867e000, return_value=0x0) at /home/ubuntu/php7/php-src/Zend/zend_vm_execute.h:458 #11 0x0000000000972c42 in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /home/ubuntu/php7/php-src/Zend/zend.c:1428 #12 0x00000000008e048d in php_execute_script (primary_file=0x7ffd2b501520) at /home/ubuntu/php7/php-src/main/main.c:2471 #13 0x0000000000a31509 in do_cli (argc=2, argv=0x252fe40) at /home/ubuntu/php7/php-src/sapi/cli/php_cli.c:974 #14 0x0000000000a326cd in main (argc=2, argv=0x252fe40) at /home/ubuntu/php7/php-src/sapi/cli/php_cli.c:1345I managed to simplify, Still need the 20001 entry, but getting the original backtrace now: 1. Download Drupal 8 2. Install Drupal via LAMP stack (Still trying to avoid that) 3. Copy the following into front.php and run it: <?php use Drupal\Core\DrupalKernel; use Symfony\Component\HttpFoundation\Request; $autoloader = require_once 'autoload.php'; $request = Request::createFromGlobals(); $kernel = DrupalKernel::createFromRequest($request, $autoloader, 'prod', FALSE); $kernel->boot(); $kernel->rebuildContainer(); print "OK".PHP_EOL; Creates the usual backtrace: Program received signal SIGSEGV, Segmentation fault. 0x000000000093ca6a in zend_mm_alloc_small (heap=0x7fffef400040, size=88, bin_num=9, __zend_filename=0xfc9940 "/home/ubuntu/php7/php-src/Zend/zend_hash.c", __zend_lineno=1716, __zend_orig_filename=0x0, __zend_orig_lineno=0) at /home/ubuntu/php7/php-src/Zend/zend_alloc.c:1291 1291 heap->free_slot[bin_num] = p->next_free_slot; (gdb) bt #0 0x000000000093ca6a in zend_mm_alloc_small (heap=0x7fffef400040, size=88, bin_num=9, __zend_filename=0xfc9940 "/home/ubuntu/php7/php-src/Zend/zend_hash.c", __zend_lineno=1716, __zend_orig_filename=0x0, __zend_orig_lineno=0) at /home/ubuntu/php7/php-src/Zend/zend_alloc.c:1291 #1 0x000000000093ccc1 in zend_mm_alloc_heap (heap=0x7fffef400040, size=88, __zend_filename=0xfc9940 "/home/ubuntu/php7/php-src/Zend/zend_hash.c", __zend_lineno=1716, __zend_orig_filename=0x0, __zend_orig_lineno=0) at /home/ubuntu/php7/php-src/Zend/zend_alloc.c:1359 #2 0x000000000093f724 in _emalloc (size=56, __zend_filename=0xfc9940 "/home/ubuntu/php7/php-src/Zend/zend_hash.c", __zend_lineno=1716,