php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #57370 APC SIGSEGV (_zend_is_inconsistent) [with apc.rfc187]
Submitted: 2006-11-12 06:54 UTC Modified: 2006-11-16 15:26 UTC
From: olivier at reagi dot com Assigned:
Status: Closed Package: APC (PECL)
PHP Version: 5.2.1 OS: Linux Fedora 2.6.17
Private report: No CVE-ID: None
 [2006-11-12 06:54 UTC] olivier at reagi dot com
Description:
------------
APC is causing PHP to segfault when executing a php file.
Everyting is ok when PHP is just loaded (i.e. "php -v")


Reproduce code:
---------------
Hi,

I'm using PHP with the latest APC (from the CVS).

$ php -v
PHP 5.2.1-dev (cgi-fcgi) (built: Nov 12 2006 12:50:38) (DEBUG)
== > it's ok

$ php test.php
segmentation fault


Content of test.php :
<? phpinfo(); ?>

(same result with just an echo "hello world"; )


I compiled again with --enable-debug in both PHP and APC to give you more details:

Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread -1208743632 (LWP 28872)]
0x083383d9 in _zend_is_inconsistent (ht=0x1, file=0x8477964 "/usr/src/php5.2-200611120930/Zend/zend_hash.c", line=965) at /usr/src/php5.2-200611120930/Zend/zend_hash.c:53
53              if (ht->inconsistent==HT_OK) {
(gdb) bt
#0  0x083383d9 in _zend_is_inconsistent (ht=0x1, file=0x8477964 "/usr/src/php5.2-200611120930/Zend/zend_hash.c", line=965) at /usr/src/php5.2-200611120930/Zend/zend_hash.c:53
#1  0x0833ae68 in zend_hash_index_find (ht=0x1, h=3085992512, pData=0xbfbb4048) at /usr/src/php5.2-200611120930/Zend/zend_hash.c:965
#2  0x0019236c in my_copy_zval (dst=0xafd12d1c, src=0xb7f08240, allocate=0x198c00 <apc_sma_malloc>, deallocate=0x198dc0 <apc_sma_free>) at /usr/src/pecl/apc/apc_compile.c:291
#3  0x00192748 in my_copy_znode (dst=0xafd12d18, src=Variable "src" is not available.
) at /usr/src/pecl/apc/apc_compile.c:392
#4  0x00192834 in my_copy_zend_op (dst=0xafd12d00, src=0xb7f08224, allocate=0x198c00 <apc_sma_malloc>, deallocate=0x198dc0 <apc_sma_free>) at /usr/src/pecl/apc/apc_compile.c:409
#5  0x00193ee3 in apc_copy_op_array (dst=0xafd12c30, src=0xb7f08054, allocate=0x198c00 <apc_sma_malloc>, deallocate=0x198dc0 <apc_sma_free>) at /usr/src/pecl/apc/apc_compile.c:1252
#6  0x00195b6d in my_compile_file (h=0xbfbb8550, type=8) at /usr/src/pecl/apc/apc_main.c:404
#7  0x0832e50c in zend_execute_scripts (type=8, retval=0x0, file_count=3) at /usr/src/php5.2-200611120930/Zend/zend.c:1090
#8  0x082ddc75 in php_execute_script (primary_file=0xbfbb8550) at /usr/src/php5.2-200611120930/main/main.c:1758
#9  0x083a850b in main (argc=2, argv=0xbfbb8694) at /usr/src/php5.2-200611120930/sapi/cgi/cgi_main.c:1632


Everything is ok when I deactivate apc.so (compiled in module, so when I comment extension=apc.so).


Expected result:
----------------
Code should execute.

Actual result:
--------------
Segfault (SIGSEGV)

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-11-12 07:42 UTC] gopalv82 at yahoo dot com
Is the php is compiled with TSRM ?

The apc_globals->copied_zvals is initialized to NULL in 
php_apc_init_globals, I'm still wondering how it came to have 0x01 as the pointer value.
 [2006-11-12 07:48 UTC] olivier at reagi dot com
PHP is configured with:

./configure  --enable-fastcgi --disable-cli --enable-force-cgi-redirect --with-mysql --with-config-file-path=/etc --with-gd --with-zlib-dir=/usr --with-freetype --with-freetype-dir --with-ttf --with-jpeg --with-gif --with-jpeg-dir=/usr/lib --with-png --with-png-dir=/usr/lib --enable-debug

Nothing about TSRM
 [2006-11-12 12:03 UTC] olivier at reagi dot com
For information, APC 3.0.12p2 is compiling just fine with exactly the same PHP.
I wanted cvs version for apc.rfc1867 support.
 [2006-11-12 12:42 UTC] olivier at reagi dot com
I don't know if this is linked, but I see there was a modification on the CVS a few hours ago, and the description is "Fix TSRM build".

I rebuild APC with the latest version (including this fix so) : same result (SIGSEGV, in the same line).
 [2006-11-14 05:50 UTC] olivier at reagi dot com
The segfault disappeared when I commented the line:
apc.rfc1867 = 1

=> APC is working great when rfc1867 support is off.

This seems to be the same bug as #9323
 [2006-11-16 15:26 UTC] gopalv82 at yahoo dot com
Fixed in CVS - sorry for the delay, was in the last place I'd have looked :)

http://news.php.net/php.pecl.cvs/6643

Thanks for the bug report.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 22:01:28 2024 UTC