php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #56195 php-4.3.3/ext/apc/apc_compile.c(921) : Freeing 0x0020AA50 (84 bytes)
Submitted: 2004-09-21 08:09 UTC Modified: 2014-02-28 12:35 UTC
From: s dot masugata at digicom dot dnp dot co dot jp Assigned: krakjoe (profile)
Status: Closed Package: APC (PECL)
PHP Version: 4.3.3 OS: Solaris8
Private report: No CVE-ID: None
 [2004-09-21 08:09 UTC] s dot masugata at digicom dot dnp dot co dot jp
Description:
------------
Program is performed from a Web server, such 
description will be recorded as an error log.

/***/src/php-4.3.3/ext/apc/apc_compile.c(921) :  Freeing 0x0020AA50 (84 bytes), script=/***/***/***/apc.php
Last leak repeated 105 times

./configure \
--with-apxs=/usr/local/apache-php4/bin/apxs \
--enable-debug \
--without-pear \
--enable-apc \
--enable-sem \
--disable-cli \
--with-openssl=/usr/local/ssl \
--enable-zend-multibyte \
--enable-mbstring \
--enable-mbregex \
--with-mysql=/usr/local/mysql \
--with-oci8=/usr/local/oracle9i \
--enable-sigchild \
--with-mcrypt=/usr/local \
--with-gd \
--with-jpeg-dir=/usr/local \
--with-png-dir=/usr/local \
--with-freetype-dir=/usr/local \
--with-zlib-dir=/usr/local \
--with-curl=/usr/local \
--with-dom=/usr/local \
--enable-ftp \
--enable-sockets \
--enable-bcmath \
--with-zlib=/usr/local \
--enable-versioning

apc.enabled        = 1
apc.shm_segments   = 1
apc.shm_size       = 3
apc.optimization   = 0
apc.num_files_hint = 1000
apc.gc_ttl         = 3600
apc.filters        = none;
;apc.mmap_file_mask = /tmp

Reproduce code:
---------------
<?
include_once( "/***/***/***/My_lib1.inc" );
include_once( "/***/***/***/My_lib2.inc" );
include_once( "/***/***/***/My_lib3.inc" );

echo "done!!";

print_r( apc_cache_info( ) );
print_r( apc_sma_info( ) );
?>



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-09-24 16:03 UTC] Rasmus@php.net
I tried to recreate this with the current cvs version and wasn't able to.  Anything special in your include files?
And could you try it with the current CVS version?
 [2004-09-27 02:03 UTC] s dot masugata at digicom dot dnp dot co dot jp
Thank you for reply. :)
An include file is a file which defined the mere function.

It checked by apc CVS version.
The result was the same.

/***/src/php-4.3.3/ext/apc/apc_compile.c(1151) :  Freeing 0x0024C030 (84 bytes), script=/***/***/***/apc.php

phpinfo :
------------------------------------------------------------
apache(DSO)

APACHE_INCLUDE      no value
APACHE_TARGET       no value
Apache Version      Apache/1.3.31
Apache Release      10331100
Apache API Version  19990320


APC Support   enabled

Version       2.1.0
MMAP Support  Disabled
Revision      $Revision: 3.38 $
Build Date    Sep 27 2004 14:03:11

apc.cache_by_default  1 1
apc.enabled           1 1
apc.filters           no value no value
apc.gc_ttl            3 3
apc.num_files_hint    1000 1000
apc.optimization      0 0
apc.shm_segments      1 1
apc.shm_size          3 3
apc.ttl               0 0
apc.user_entries_hint 100 100
apc.user_ttl          0 0
------------------------------------------------------------

PHP is built in debugging mode.

When APC(cvs version) was built, there was fault.
It avoided by correcting a file.

before:
apc_main.c
php_apc.c
------------------------------------------------------------
#undef XtOffsetOf
#include "httpd.h"
#endif
------------------------------------------------------------

after:
apc_main.c
php_apc.c
------------------------------------------------------------
#undef XtOffsetOf
#include "/usr/local/apache-php4/include/httpd.h"
#endif
------------------------------------------------------------


Moreover, if renewal of a file and access to a file are 
performed at the period, it may crash.

It checked by apc CVS version.

Apache error_log:
------------------------------------------------------------
/***/src/php-4.3.3/ext/apc/apc_cache.c:625: failed assertion `entry->ref_count == 0'
[Mon Sep 27 14:18:20 2004] [notice] child pid 22246 exit signal Abort (6)
------------------------------------------------------------

In my environment, it reappears by performing this procedure.

First, ab script is performed.
/usr/local/apache-php4/bin/ab -n 1000 -c 100 http://www.example.com/apc.php

Next, while performing ab script, the file included by apc.php is updated.
touch test1/*.inc test2/*.inc test3/*.inc

While performing ab script, renewal of a file is performed repeatedly.

touch test1/*.inc test2/*.inc test3/*.inc
touch test1/*.inc test2/*.inc test3/*.inc
touch test1/*.inc test2/*.inc test3/*.inc
...
...
...
...
...
...

At least 30 file's of the actually included files exist.


A situation becomes still worse although it is the same when it 
is not a CVS version(2.0, 2.0.4).

Apache error_log:
------------------------------------------------------------
/***/src/php-4.3.3/ext/apc/apc_cache.c:376: failed assertion `entry->ref_count == 0'
[Wed Sep 22 21:05:08 2004]  Script:  '/***/***/***/apc.php'
---------------------------------------
/***/src/php-4.3.3/Zend/zend_opcode.c(152) : Block 0xFE370B90 status:
Beginning:  	Overrun (magic=0x4F726163, expected=0x7312F8DC)
      End:	Unknown
---------------------------------------
[Wed Sep 22 21:05:08 2004]  Script:  '/***/***/***/apc.php'
---------------------------------------
/***/src/php-4.3.3/Zend/zend_opcode.c(159) : Block 0xFE371758 status:
/***/src/php-4.3.3/Zend/zend_variables.c(44) : Actual location (location was relayed)
Beginning:  	Overrun (magic=0x00000008, expected=0x7312F8DC)
      End:	Unknown
---------------------------------------
[Wed Sep 22 21:05:09 2004] [notice] child pid 28205 exit signal Segmentation Fault (11)
[Wed Sep 22 21:05:10 2004] [notice] child pid 28227 exit signal Bus Error (10)
[Wed Sep 22 21:05:09 2004] [notice] child pid 28206 exit signal Abort (6)
------------------------------------------------------------
 [2004-09-27 04:55 UTC] s dot masugata at digicom dot dnp dot co dot jp
RedHat9 Linux was also reproduced in the same procedure.

However, it was able to be made to crash by performing 
renewal of long time, load, and a file in the case of RedHat9 Linux.

Solaris8(sparc) crashes immediately.
 [2004-09-27 09:38 UTC] Rasmus@php.net
Not that it should really make a difference, but could you try switching to a file-backed mmap?  Add this line to your ini:

apc.mmap_file_mask=/tmp/apc.XXXXXX

And restart.
 [2004-09-27 11:13 UTC] s dot masugata at digicom dot dnp dot co dot jp
It tried by mmap(apc cvs version).

php.ini:
apc.mmap_file_mask=/tmp/apc.XXXXXX

And Apache stop & start.

Solaris8(sparc) crashes immediately.
RedHat9 Linux did not crash.

Furthermore, a this result may be different if load is hung.
 [2014-02-28 12:35 UTC] krakjoe@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: krakjoe
 [2014-02-28 12:35 UTC] krakjoe@php.net
Closing, for a number of reasons:

 The bug is ~10 years old.
 The original behaviour cannot be present any more.
 APC is no longer the primary, supported means by which we advise caching opcodes.

Thanks for helping to make PHP better :)
 
PHP Copyright © 2001-2019 The PHP Group
All rights reserved.
Last updated: Mon Apr 22 00:01:25 2019 UTC