|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2005-12-18 04:37 UTC] php at sagi dot org
Description:
------------
I'm trying to run APC under PHP5.1.1 (stable), running on apache2.0.54, prefork MPM.
I tried installing both APC3.0.8 and latest CVS and got the same result.
PHP configuration is:
'./configure' '--prefix=/usr/local/php5' '--with-apxs2=/usr/bin/apxs2' '--with-zlib' '--with-mysql=shared' '--with-pgsql=shared' '--with-sqlite=shared' '--with-pdo=shared' '--with-pdo-pgsql=shared' '--with-pdo-mysql=shared' '--with-pdo-sqlite=shared' '--with-pear=/usr/local/php5/share/pear' '--with-xmlrpc' '--enable-soap' '--with-gettext=shared' '--with-gd=shared' '--with-jpeg-dir=shared,/usr' '--with-xsl=shared' '--enable-memory-limit'
APC cconfiguration is:
./configure --enable-apc --enable-apc-mmap --with-apxs=/usr/bin/apxs2 --with-php-config=/usr/local/php5/bin/php-config
After stating apache, the first request usually goes fine, but the second one crashes the server with the following segfault:
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1214191936 (LWP 2267)]
0xb7880e0e in _zend_hash_add_or_update (ht=0x831e938, arKey=Variable "arKey" is not available.
) at /usr/local/src/php-5.1.1/Zend/zend_hash.c:215
215 if ((p->h == h) && (p->nKeyLength == nKeyLength)) {
The same setup works well without APC of course.
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 06 10:00:01 2025 UTC |
Still happens with auto_globals_jit turned off. Finally managed to write a minimal sample: --- class ParentTest { private static $_children = array(); } class ChildTest extends ParentTest { } print_r(new ChildTest); --- Seems like the private static in the parent is what crashes it. If I change it to public remove the static it doesn't crash. I guess it's not the only thing, because even after I removed this from the main application it still crashes. I'll try to isolate the other causes but this one above almost always crashes on 2nd request.Still crashes with the above sample. Now I get: [Sun Jan 08 10:15:29 2006] [notice] child pid 24422 exit signal Segmentation fault (11) Allowed memory size of 8388608 bytes exhausted (tried to allocate 1668246610 bytes) I also saw this message once: /usr/local/src/cvs/pecl/apc/apc_compile.c:2022 ChildTest::_children removed The backtrace is different now: (gdb) where #0 0x41074cea in my_copy_zval_ptr (dst=0x82e1f64, src=0x4, allocate=0x4107bf20 <apc_php_malloc>, deallocate=0x4107bf50 <apc_php_free>) at /usr/local/src/cvs/pecl/apc/apc_compile.c:250 #1 0x41075c8c in my_copy_hashtable_ex (dst=0x82e1d50, src=0x81f282c, copy_fn=0x41074cb0 <my_copy_zval_ptr>, free_fn=0x410770e0 <my_free_zval_ptr>, holds_ptrs=1, allocate=0x4107bf20 <apc_php_malloc>, deallocate=0x4107bf50 <apc_php_free>, check_fn=0) at /usr/local/src/cvs/pecl/apc/apc_compile.c:894 #2 0x41077696 in apc_copy_class_entry_for_execution (src=0x41081720, is_derived=0) at /usr/local/src/cvs/pecl/apc/apc_compile.c:1831 #3 0x4107861d in install_class (cl= {name = 0x41081708 "parenttest", name_len = 10, is_derived = 0, parent_name = 0x0, class_entry = 0x41081720}, tsrm_ls=0x81a4f70) at /usr/local/src/cvs/pecl/apc/apc_main.c:105 #4 0x410787e8 in cached_compile (tsrm_ls=0x81a4f70) at /usr/local/src/cvs/pecl/apc/apc_main.c:190 #5 0x410789b8 in my_compile_file (h=0xbffff770, type=2, tsrm_ls=0x81a4f70) at /usr/local/src/cvs/pecl/apc/apc_main.c:253 #6 0x4089bff1 in zend_execute_scripts (type=8, tsrm_ls=0x81a4f70, retval=0x0, file_count=3) at /usr/local/src/php-5.1.1/Zend/zend.c:1082 #7 0x4085b174 in php_execute_script (primary_file=0xbffff770, tsrm_ls=0x81a4f70) at /usr/local/src/php-5.1.1/main/main.c:1704 #8 0x40919c9d in php_handler (r=0x82d5fd8) at /usr/local/src/php-5.1.1/sapi/apache2handler/sapi_apache2.c:584 #9 0x08078375 in ap_run_handler () #10 0x08078980 in ap_invoke_handler () #11 0x08069c6a in ap_process_request () #12 0x0806512d in _start () #13 0x082d5fd8 in ?? () #14 0x00000004 in ?? () #15 0x082d5fd8 in ?? () #16 0x0808370c in ap_run_pre_connection () #17 0x080835c5 in ap_run_process_connection () #18 0x08076974 in ap_graceful_stop_signalled () #19 0x08076b8b in ap_graceful_stop_signalled () #20 0x08076be8 in ap_graceful_stop_signalled () #21 0x0807745a in ap_mpm_run () #22 0x0807da8d in main () (gdb)I have been getting this same bug. Referencing a static class variable that is extended in a child class results in a segfault in the apache error log and the page fails to load. With APC disabled, the script executes normally. The first request always loads fine, but any subsequent page loads result in a segfault error in the apache error log and the script exits prematurely. Tailing the apache error log reveals the following error appears after each request to the page: child pid {#######} exit signal Segmentation fault (11). I was able to play around with a few examples to reproduce the bug. This creates a segaults: --- class ParentTest{ static $name = 'test'; } class ChildTest extends ParentTest { } print_r(ParentTest::$name); ---- This appears to work correctly: --- class ParentTest{ static $name = 'test'; } class ChildTest extends ParentTest { $name = 'test'; } print_r(ParentTest::$name); print_r(ChildTest::$name2); ---- This also appears to work correctly: --- class ParentTest{ static $name = 'test'; } class ChildTest extends ParentTest { static $name2 = 'test2'; } print_r(ParentTest::$name); print_r(ChildTest::$name2); ---- PHP 5.1.2 on Linux 2.6.15.2 with Apache 2.0.52 ============================================================ =========== ./configure' '--prefix=/usr/local/' '--enable-cli' '-- disable-cgi' '--enable-pcntl' '--enable-sigchild' '--enable- sockets' '--enable-shmop' '--enable-sysvsem' '--enable- sigchild' '--with-gd' '--enable-gd-native-ttf' '--with-ttf' '--with-png' '--with-zlib' '--enable-bcmath' '--with-regex' '--with-xml' '--with-xmlrpc' '--enable-wddx' '--enable- memory-limit' '--enable-calendar' '--with-pear' '--with- mysql=/usr/' '--with-apxs2=/usr/local/apache2/bin/apxs' APC Support enabled Version 3.0.8 MMAP Support Enabled MMAP File Mask no value Revision $Revision: 3.68 $ Build Date Feb 3 2006 11:11:25I still get reproducible apache segfaults on second load ("[notice] child pid ### exit signal Segmentation fault (11)") in my symfony (www.symfony-project.com) applications with a recent APC CVS checkout ($Revision: 3.79 $) and PHP Version 5.1.2. To reproduce it download the symfony sandbox: http://www.symfony-project.com/get/sf_sandbox.tgz extract it to a web accessible path, then in sf_sandbox/apps/frontend/config/settings.yml replace the line # i18n: off with i18n: on Finally navigate to sf_sandbox/web/ Then hit reload and watch it segfault... Unfortunately I haven't been able to produce a simple test case due to my total incapability... *g* Sorry for that.