php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64625 Segfault on PHP 5.4.13 and APC 3.1.13
Submitted: 2013-04-10 16:31 UTC Modified: 2016-11-18 21:15 UTC
Votes:8
Avg. Score:4.4 ± 0.9
Reproduced:8 of 8 (100.0%)
Same Version:2 (25.0%)
Same OS:0 (0.0%)
From: raresvla at gmail dot com Assigned:
Status: Wont fix Package: APC (PECL)
PHP Version: 5.4.13 OS: Ubuntu 12.04
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: raresvla at gmail dot com
New email:
PHP Version: OS:

 

 [2013-04-10 16:31 UTC] raresvla at gmail dot com
Description:
------------
We have a complex application, which uses frameworks like Symfony2, Doctrine2, ZF1 and has a lot of traffic.

We are trying to upgrade to PHP 5.4 (from 5.3.14, which is currently in production), but we are encountering a lot of segfaults in php-fpm or fatal errors like:

* require(): Failed opening required '/path/to/vendor/symfony/symfony/src/Symfonyl 6sr ' - here the file name is corrupted.
* Undefined class constant '/path/to/actual/source/file.php' - notice the file path instead of constant name;

PHP Configure Command =>  './configure'  '--with-mysql' '--with-gd' '--with-gettext' '--with-imap' '--with-imap-ssl' '--enable-ftp' '--with-ldap' '--with-ldap-sasl' '--enable-mbstring' '--with-mcrypt' '--with-pdo-mysql' '--enable-pcntl' '--enable-zip' '--with-pear' '--with-config-file-path=/etc/php5/apache2' '--with-config-file-scan-dir=/etc/php5/conf.d/' '--with-openssl' '--with-openssl-dir=/usr' '--with-freetype-dir=/usr' '--with-jpeg-dir=/usr' '--with-png-dir=/usr' '--with-xpm-dir=/usr' '--with-kerberos' '--enable-sockets' '--with-curl' '--enable-soap' '--enable-fpm' '--prefix=/opt/php-fpm' '--with-zlib' '--with-zlib-dir=/usr' '--with-libdir=lib/x86_64-linux-gnu'

Test script:
---------------
I cannot provide a code for replicating the issue - it seems to me that it occurs randomly - but a lot.

Expected result:
----------------
No seg fault.

Actual result:
--------------
Program received signal SIGSEGV, Segmentation fault.
zend_mm_remove_from_free_list (heap=0x2dd4580, mm_block=0x3b9c4d0) at /root/admin/php-5.4.13/Zend/zend_alloc.c:833
833                     if (UNEXPECTED(prev->next_free_block != mm_block) || UNEXPECTED(next->prev_free_block != mm_block)) {
(gdb) bt
#0  zend_mm_remove_from_free_list (heap=0x2dd4580, mm_block=0x3b9c4d0) at /root/admin/php-5.4.13/Zend/zend_alloc.c:833
#1  0x0000000000771940 in _zend_mm_free_int (heap=0x2dd4580, p=0x3b9c488) at /root/admin/php-5.4.13/Zend/zend_alloc.c:2101
#2  0x00000000007a35ae in zend_hash_destroy (ht=0x3b9c390) at /root/admin/php-5.4.13/Zend/zend_hash.c:565
#3  0x00000000007950fa in _zval_dtor_func (zvalue=0x3b70690) at /root/admin/php-5.4.13/Zend/zend_variables.c:45
#4  0x0000000000787792 in _zval_dtor (zvalue=<optimized out>) at /root/admin/php-5.4.13/Zend/zend_variables.h:35
#5  _zval_ptr_dtor (zval_ptr=0x3ba3ab8) at /root/admin/php-5.4.13/Zend/zend_execute_API.c:438
#6  _zval_ptr_dtor (zval_ptr=0x3ba3ab8) at /root/admin/php-5.4.13/Zend/zend_execute_API.c:427
#7  0x00000000007b6067 in zend_object_std_dtor (object=0x3b84360) at /root/admin/php-5.4.13/Zend/zend_objects.c:54
#8  0x00000000007b6099 in zend_objects_free_object_storage (object=0x3b84360) at /root/admin/php-5.4.13/Zend/zend_objects.c:137
#9  0x00000000007bbe37 in zend_objects_store_del_ref_by_handle_ex (handle=783, handlers=<optimized out>) at /root/admin/php-5.4.13/Zend/zend_objects_API.c:221
#10 0x00000000007bbe53 in zend_objects_store_del_ref (zobject=0x3b6e340) at /root/admin/php-5.4.13/Zend/zend_objects_API.c:173
#11 0x0000000000787792 in _zval_dtor (zvalue=<optimized out>) at /root/admin/php-5.4.13/Zend/zend_variables.h:35
#12 _zval_ptr_dtor (zval_ptr=0x3be4848) at /root/admin/php-5.4.13/Zend/zend_execute_API.c:438
#13 _zval_ptr_dtor (zval_ptr=0x3be4848) at /root/admin/php-5.4.13/Zend/zend_execute_API.c:427
#14 0x00000000007a3588 in zend_hash_destroy (ht=0x3bb2760) at /root/admin/php-5.4.13/Zend/zend_hash.c:560
#15 0x00000000007950fa in _zval_dtor_func (zvalue=0x3bb27b8) at /root/admin/php-5.4.13/Zend/zend_variables.c:45
#16 0x0000000000787792 in _zval_dtor (zvalue=<optimized out>) at /root/admin/php-5.4.13/Zend/zend_variables.h:35
#17 _zval_ptr_dtor (zval_ptr=0x3b99870) at /root/admin/php-5.4.13/Zend/zend_execute_API.c:438
#18 _zval_ptr_dtor (zval_ptr=0x3b99870) at /root/admin/php-5.4.13/Zend/zend_execute_API.c:427
#19 0x00000000007b6067 in zend_object_std_dtor (object=0x3b67540) at /root/admin/php-5.4.13/Zend/zend_objects.c:54
#20 0x00000000007b6099 in zend_objects_free_object_storage (object=0x3b67540) at /root/admin/php-5.4.13/Zend/zend_objects.c:137
#21 0x00000000007bbe37 in zend_objects_store_del_ref_by_handle_ex (handle=777, handlers=<optimized out>) at /root/admin/php-5.4.13/Zend/zend_objects_API.c:221
#22 0x00000000007bbe53 in zend_objects_store_del_ref (zobject=0x3444450) at /root/admin/php-5.4.13/Zend/zend_objects_API.c:173
#23 0x0000000000787792 in _zval_dtor (zvalue=<optimized out>) at /root/admin/php-5.4.13/Zend/zend_variables.h:35
#24 _zval_ptr_dtor (zval_ptr=0x3c08958) at /root/admin/php-5.4.13/Zend/zend_execute_API.c:438
#25 _zval_ptr_dtor (zval_ptr=0x3c08958) at /root/admin/php-5.4.13/Zend/zend_execute_API.c:427
#26 0x00000000007a3588 in zend_hash_destroy (ht=0x3b67fb8) at /root/admin/php-5.4.13/Zend/zend_hash.c:560
#27 0x00000000007950fa in _zval_dtor_func (zvalue=0x3b6cc50) at /root/admin/php-5.4.13/Zend/zend_variables.c:45
#28 0x0000000000787792 in _zval_dtor (zvalue=<optimized out>) at /root/admin/php-5.4.13/Zend/zend_variables.h:35
#29 _zval_ptr_dtor (zval_ptr=0x3b8ff48) at /root/admin/php-5.4.13/Zend/zend_execute_API.c:438
#30 _zval_ptr_dtor (zval_ptr=0x3b8ff48) at /root/admin/php-5.4.13/Zend/zend_execute_API.c:427
#31 0x00007f9dda04856f in apc_free_class_entry_after_execution (src=0x3b88640) at /tmp/pear/temp/APC/apc_compile.c:1992
#32 0x00007f9dda04bad6 in apc_deactivate () at /tmp/pear/temp/APC/apc_main.c:948
#33 apc_request_shutdown () at /tmp/pear/temp/APC/apc_main.c:1042
#34 0x00007f9dda0405b5 in zm_deactivate_apc (type=<optimized out>, module_number=<optimized out>) at /tmp/pear/temp/APC/php_apc.c:407
#35 0x000000000079ced4 in zend_deactivate_modules () at /root/admin/php-5.4.13/Zend/zend_API.c:2335
#36 0x0000000000737305 in php_request_shutdown (dummy=<optimized out>) at /root/admin/php-5.4.13/main/main.c:1769
#37 0x0000000000435d13 in main (argc=<optimized out>, argv=<optimized out>) at /root/admin/php-5.4.13/sapi/fpm/fpm/fpm_main.c:1952





Extra:

For autoloading, we use a custom, decorated version of ComposerAutoloader (https://github.com/composer/composer/blob/master/src/Composer/Autoload/ClassLoader.php) which uses APC for caching.

Our APC configuration is (generally defaults, with apc.stat=0):

[apc]
apc.stat = false
apc.stat_ctime = false
apc.slam_defense = 0                    ;spreads load on startup, only caches percent of requests
apc.write_lock = 1                      ;the non blocking write lock us preferred to setting slam_defense
apc.file_update_protection = 2          ;read updated files after given delay to prevent loading incomplete files
apc.ttl = 0                             ;max ttl
apc.user_ttl = 0
apc.gc_ttl = 3600                       ;remove expired entries as soon as gc ttl expires
apc.max_file_size = 1M                  ;limits the maximum file size in cache
apc.filters = "(.*dashboard.*)|(.*includes.*)"
apc.cache_by_default = true             ;cache all files that DON'T match filters

apc.rfc1867 = On                        ;upload progress support
apc.rfc1867_freq = 0                    ;update freq in percent of file size or per byte count
apc.rfc1867_name = APC_UP_PROGRESS      ;hidden form input name for apc user variable key
apc.rfc1867_prefix = upload_            ;prefix for the apc user variable key

apc.shm_size = 256M
apc.include_once_override = 0

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-04-10 16:59 UTC] rasmus@php.net
-Status: Open +Status: Analyzed
 [2013-04-10 16:59 UTC] rasmus@php.net
If you are having problems with APC and PHP 5.4 I suggest trying 
http://pecl.php.net/package/ZendOpcache instead. That is where development is 
focused now.
 [2013-09-02 07:42 UTC] m dot staab at complex-it dot de
we also get undefined class constant errors like described above, where the constant name looks like a FQCN, e.g. 

PHP Fatal error:  Undefined class constant '/library/Requests/Auth/Basic.php' in YY.php on line XX

not sure if it is an APC bug or php bug.

we are on PHP 5.4.15-1~precise+1 using APC 3.1.13
 [2016-04-25 20:52 UTC] psolovyov at gmail dot com
We are having also issue on APC (3.1.13) and PHP 5.4.45. Magento store throwing 500 errors at checkout. 

As soon as APC was removed as source of caching for the store, the errors stopped.
 [2016-11-18 21:15 UTC] kalle@php.net
-Status: Analyzed +Status: Wont fix
 [2016-11-18 21:15 UTC] kalle@php.net
APC is no longer supported in favor of opcache that comes bundled with PHP, if you wish to use the user cache, then look at PECL/APCu.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 06:01:28 2024 UTC