Author: cfinck Date: Thu Apr 2 23:15:06 2009 New Revision: 40335
URL: http://svn.reactos.org/svn/reactos?rev=40335&view=rev Log: Add a reasonable memory limit for a test result log, so the script doesn't exceed PHP's memory limit in case of bloated logs Uses memory_get_usage(), so the script needs PHP >= 5.2
Modified: branches/danny-web/reactos.org/htdocs/testman/webservice/buildbot_aggregator.php branches/danny-web/reactos.org/htdocs/testman/webservice/config.inc.php
Modified: branches/danny-web/reactos.org/htdocs/testman/webservice/buildbot_aggregator.php URL: http://svn.reactos.org/svn/reactos/branches/danny-web/reactos.org/htdocs/tes... ============================================================================== --- branches/danny-web/reactos.org/htdocs/testman/webservice/buildbot_aggregator.php [iso-8859-1] (original) +++ branches/danny-web/reactos.org/htdocs/testman/webservice/buildbot_aggregator.php [iso-8859-1] Thu Apr 2 23:15:06 2009 @@ -93,6 +93,14 @@ break; $log .= $line; + + // We can easily exceed PHP's memory limit here in case we're reading a bloated log + // Stop in this case + if(memory_get_usage() > MAX_MEMORY) + { + $log .= "[TESTMAN] Maximum memory for log exceeded, aborting!"; + break; + } } while(strpos($line, " tests executed (") === false && substr($line, 0, 9) != "[SYSREG] " && !feof($fp));
Modified: branches/danny-web/reactos.org/htdocs/testman/webservice/config.inc.php URL: http://svn.reactos.org/svn/reactos/branches/danny-web/reactos.org/htdocs/tes... ============================================================================== --- branches/danny-web/reactos.org/htdocs/testman/webservice/config.inc.php [iso-8859-1] (original) +++ branches/danny-web/reactos.org/htdocs/testman/webservice/config.inc.php [iso-8859-1] Thu Apr 2 23:15:06 2009 @@ -7,4 +7,11 @@ */
define("TESTMAN_PATH", "../"); + + // Ensure we don't get bloated logs or even exceed PHP's memory limit + // by defining a maximum amount of memory, which may be allocated by the + // aggregator script + // NOTE: The aggregator script allocates memory per test result, so this + // has no effect on the total log size + define("MAX_MEMORY", 500000); ?>