Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Segmentation Fault in PHP7

We have encountered this weird issue with PHP 7.0. We are running Magento2's indexers on PHP 7.0 and have different outcomes on different environments. If we use CentOS, and get PHP 7.0 from either Remi's Repo or Webtatic Repo, we get a Segmentation Fault as follows:

Program received signal SIGSEGV, Segmentation fault.
zend_mm_alloc_small (size=<optimized out>, bin_num=<optimized out>, heap=<optimized out>) at /usr/src/debug/php-7.0.1RC1/Zend/zend_alloc.c:1291
1291                    heap->free_slot[bin_num] = p->next_free_slot;
Missing separate debuginfos, use: debuginfo-install openssl-libs-1.0.1e-51.el7_2.1.x86_64
(gdb) backtrace
#0  zend_mm_alloc_small (size=<optimized out>, bin_num=<optimized out>, heap=<optimized out>) at /usr/src/debug/php-7.0.1RC1/Zend/zend_alloc.c:1291
#1  zend_mm_alloc_heap (size=<optimized out>, heap=<optimized out>) at /usr/src/debug/php-7.0.1RC1/Zend/zend_alloc.c:1358
#2  _emalloc (size=3, size@entry=32) at /usr/src/debug/php-7.0.1RC1/Zend/zend_alloc.c:2442
#3  0x0000555555666840 in zend_string_alloc (persistent=0, len=4) at /usr/src/debug/php-7.0.1RC1/Zend/zend_string.h:121
#4  php_pcre_replace_impl (pce=pce@entry=0x555555e76e40, subject_str=subject_str@entry=0x7fffd72fec68, subject=subject@entry=0x7fffd72fec80 "TypeId", subject_len=subject_len@entry=6, replace_val=replace_val@entry=0x7fffd2a393b0,
    is_callable_replace=is_callable_replace@entry=0, limit=<optimized out>, limit@entry=-1, replace_count=replace_count@entry=0x7fffffff7d5c) at /usr/src/debug/php-7.0.1RC1/ext/pcre/php_pcre.c:1217

But, if we use a compiled PHP7 version, there is no error. We also tried with a vagrant box configured with Ubuntu 14.0 and PHP 7.0.0 from ppa:ondrej/php-7.0 and no issues there either.

Any ideas why this error occurs when using these specific repos?

Updated with 7.0.1 stack trace is different:

`Program received signal SIGSEGV, Segmentation fault.
0x00007fffded34620 in ?? ()
#0  0x00007fffded34620 in ?? ()
#1  0x00005555557db82b in execute_ex (ex=<optimized out>) at /usr/src/debug/php-7.0.1/Zend/zend_vm_execute.h:414
#2  0x000055555578ddd9 in dtrace_execute_ex (execute_data=<optimized out>) at /usr/src/debug/php-7.0.1/Zend/zend_dtrace.c:83
like image 215
Maddy Avatar asked Dec 17 '15 20:12

Maddy


1 Answers

Please see this link from Magento forum:

https://community.magento.com/t5/Installing-Magento-2/PHP-7-Segmentation-Fault-CentOS-7-x/td-p/25031

And this from official repo: https://github.com/magento/magento2/issues/2750

During some local tests I've replicated this problem (Ubuntu 14.04 with ppa:ondrej/php-7.0), and the worse part is that "segmentation fault" would keep the indexer as "processing" (make sense as it was not finished successfully), we had to change data table (indexer_state) and manually fixed those values before re-run the re-index.

Seems like Magento 2 has not "fully" supported PHP7?

like image 99
nickksun Avatar answered Oct 01 '22 16:10

nickksun