|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2004-06-08 18:02 UTC] swen at grmblfrz dot de
Description:
------------
apc seems to have a problem with log4php: when trying to load
LoggerAppenderFile.php it will fill all the available shared memory, because it caches the same class again and again (or so it seems).
The following patch seems to fix this, but I really have no idea, why. Again
I did some guessing by looking at the source of turck-mmcache. But
this might be a starting point.
Again, please give me feedback...
diff -u -b -r3.7 apc_compile.c
--- apc_compile.c 1 Jun 2004 21:16:54 -0000 3.7
+++ apc_compile.c 8 Jun 2004 22:09:33 -0000
@@ -219,6 +219,7 @@
break;
case IS_OBJECT:
+#if 0
CHECK(dst->value.obj.ce =
my_copy_class_entry(NULL, src->value.obj.ce, allocate));
@@ -228,6 +229,7 @@
(ht_copy_fun_t) my_copy_zval_ptr,
1,
allocate));
+#endif
break;
default:
Reproduce code:
---------------
<?php
define('LOG4PHP_CONFIGURATION', 'WEB-INF/log4php.xml');
include_once('log4php/LoggerManager.php');
$log = &LoggerManager::getLogger($name);
$log->info("test, ey");
?>
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Oct 24 07:00:01 2025 UTC |
Some more data points: without my patch, the web server hangs as soon as I start using log4php. I was able to call apcinfo.php in between (code: <?php print_r(apc_cache_info()); print_r(apc_sma_info()); ?>) There already was much less available memory than usual, and there were already about 13000 entries in the block lists: Array ( [num_seg] => 1 [seg_size] => 94371840 [avail_mem] => 56568904 [block_lists] => Array ( [0] => Array ( [0] => Array ( [size] => 664 [offset] => 16359304 ) [1] => Array ( [size] => 664 [offset] => 16395304 ) [2] => Array ( [size] => 1096 [offset] => 16430872 ) [...] [12867] => Array ( [size] => 640 [offset] => 94340816 ) [12868] => Array ( [size] => 144 [offset] => 94341496 ) [12869] => Array ( [size] => 12288 [offset] => 94341680 ) [12870] => Array ( [size] => 640 [offset] => 94358816 ) [12871] => Array ( [size] => 144 [offset] => 94359496 ) [12872] => Array ( [size] => 704 [offset] => 94371128 ) ) ) ) There is a pattern here: the blocks with sizes 144, 12288 and 640 are repeated over and over again. Perhaps this helps you hunting the bug. Greetings, SwenI have the same problem with the lates version from CVS. I need the following patch to get decent performance, without it it feels like without APC, and apc_sma_info() shows there are numerous blocks of memory fragments: diff -u -r3.26 apc_compile.c --- apc_compile.c 24 Aug 2005 15:50:45 -0000 3.26 +++ apc_compile.c 13 Sep 2005 09:00:28 -0000 @@ -393,6 +393,7 @@ case IS_OBJECT: #ifndef ZEND_ENGINE_2 +#if 0 CHECK(dst->value.obj.ce = my_copy_class_entry(NULL, src->value.obj.ce, allocate, deallocate)); @@ -405,6 +406,7 @@ my_destroy_class_entry(dst->value.obj.ce, deallocate); return NULL; } +#endif break; #else dst->type = IS_NULL; Hope this helps --Swen