php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #56215 apc_fetch() memory leak
Submitted: 2004-10-18 10:18 UTC Modified: 2004-10-28 13:42 UTC
From: xuefer at 21cn dot com Assigned: rasmus (profile)
Status: Closed Package: APC (PECL)
PHP Version: Irrelevant OS: linux
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: xuefer at 21cn dot com
New email:
PHP Version: OS:

 

 [2004-10-18 10:18 UTC] xuefer at 21cn dot com
Description:
------------
echo "<pre>":
var_dump(apc_sma_info());
$k = "a....................................................";
apc_store($k, 1);
for ($i = 0; $i < 10000; $i ++) {
	apc_fetch($k);
}
var_dump(apc_sma_info());

reload the page 2+ times to see the result

i guess it's the key memory leak


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-10-18 22:29 UTC] xuefer at 21cn dot com
i've move filename from entry to key.data, renamed as identifier
now both file/user have "char *" which have exactly same behavior and function(usage)
then, i merge union struct into key struct(just make it simple)

copy pointer instead of apc_xstrdup in apc_make_*key identifier
but do apc_xstrdup in make_slot, free it in free_slot

everything goes fine, including my APC_USE_INODE seems have no core dump again

the merge of filename&identifyer make it easy to inode free
 [2004-10-26 16:49 UTC] gschlossnagle@php.net
Can you post a patch,please?
 [2004-10-26 21:22 UTC] xuefer at 21cn dot com
sure, i was hunting for space to upload

ftp://211.92.88.40/pub/moo/apc_win32.patch (with other bug fixed)
apc_cache.c apc_cache.h:
fixed for APC_USE_INODE
the struct of key is changed, maybe u don't agree.
never do strdup for key before insert!(make_slot)
"find" on the cache is more frequent than insert

apc_compile.c:
don't care about builtin_functions

apc_fcntl.c:
we have 2 locks but why only 1 file used?

apc_mmap.c:
mmap depends on shm?
"#ifdef shm_open" works? maybe u can make marco in config.m4

apc_sem.c: remove redefine warnning, maybe wrong fix

apc_shm.c: IPC_PRIVATE of TSRM seems buggy, the 2nd process will not able to create the shm

other changes:
for apc_cache apc_user_cache, don't put it in GLOBALS
------------
ftp://211.92.88.40/pub/moo/apc_optimizer.c.patch
some of this patch is posted in another bug report
this time have a new fix:
function rewrite_const_cast
-    zval_dtor(&cur->op1.u.constant);
+    /*zval_dtor(&cur->op1.u.constant);*/
i never used (string)'1' but phpmyadmin do, so i found this corrupt when i test with win32 (which i have installed phpmyadmin)

although i modified constant_fold, it's still not fixed :(
optimizer is written by cute gschlossnagle right? i saw a stantalone-but-very-old version in cvs/pecl  :P
maybe u can have a review on it


any question or complain about the patch is welcome
 [2004-10-26 21:29 UTC] xuefer at 21cn dot com
"fixed" for APC_USE_INODE
should be:
"improved" for APC_USE_INODE

btw:
this "const_cast" make phpmyadmin fine
but before "const_cast" fix(and after my other optimizer fix), it's still quite stable
it's used in production server(100MB traffic), only quite a few core dumps(for builtin_function in apc_compile) maybe 1 dump for 4months
i'd suggest make apc.optimizer to NOT EXPERIMENTAL
 [2004-10-27 14:30 UTC] Rasmus@php.net
I can't get to that ftp site.  Could you email me the patches directly?  (rasmus@php.net)
 [2004-10-27 21:48 UTC] xuefer at 21cn dot com
host was down and is up now.
i sent many emails to u but get no reply except the request for confirm. i confirmed it and no response from u(or server)
 [2004-10-28 13:42 UTC] Rasmus@php.net
I have committed a variation of your apc_fetch memory leak fix.  You changed all sorts of other stuff in your supplied patches and we will look at these separately.  One bug per report please.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 06:01:28 2024 UTC