Bug #75366 [Com]: Raising memory_limit causes script to fail with no error.

From: Date: Thu, 12 Oct 2017 20:20:52 +0000
Subject: Bug #75366 [Com]: Raising memory_limit causes script to fail with no error.
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-211660@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=75366&edit=1 ID: 75366 Comment by: spam2 at rhsoft dot net Reported by: vasilios at betoglou dot com Summary: Raising memory_limit causes script to fail with no error. Status: Closed Type: Bug Package: Reproducible crash Operating System: Linux helios 4.4.0-89-generic #1 PHP Version: 7.0.24 Block user comment: N Private report: N New Comment: > So you are right, it seems to be a link between shell_exec and memory_limit both have nothing to do with each other because memory_limit is about PHP memory manager and anything allocated with shell-commands or libmysql (in case of mysql without mysqlnd) is *not* part of the memory managment of PHO at all hence it makes no sense looking at memory_get_usage() when a large potion of your workload happens outside the PHP core Previous Comments: ------------------------------------------------------------------------ [2017-10-12 20:07:49] vasilios at betoglou dot com I'll figure a workaround using PHP native commands - thanks for the feedback. ------------------------------------------------------------------------ [2017-10-12 19:38:34] vasilios at betoglou dot com Ok, so I tried taking shell_exec out of the equation by running something simple like this: <?php $var="ABCDEFGHIJKLMNOPQRSTUVWXYZ"; while(true){ $var.=$var; echo memory_get_usage() . "<br>"; } ?> It does throw an OOM error, and if I up the value to 4096M (higher than the value I saw the issue previously), it throws a different OOM error. So you are right, it seems to be a link between shell_exec and memory_limit. Output: 358856 358936 359032 359224 359672 360568 362872 366968 375160 387448 416120 469368 575864 788856 1214840 2066808 3770768 7178640 13994384 27625872 54888848 109414800 218466704 436570512 872778128 1745193360 error.log: [Thu Oct 12 14:21:21.770973 2017] [:error] [pid 29059] [client 172.19.32.179:58966] PHP Fatal error: Allowed memory size of 4294967296 bytes exhausted (tried to allocate 3489660960 bytes) in /var/www/html/test.php on line 4 Something like this, though, worked fine: <?php $var=""; while(true){ $var.=shell_exec("echo $var"); echo memory_get_usage() . "<br>"; } ?> I.E. it threw an OOM error... so it's not necessarily the shell_exec but what it's doing. ------------------------------------------------------------------------ [2017-10-12 17:53:58] spam2 at rhsoft dot net i am not a php upstream developer but without a reproducer and with a wrong title at all it will be hard to get any further, PHP using gigabytes of RAM is no problem and since shell_exec() is part of the game the issue is probably completly out of php scope at all in any case a reprdocuer is needed because nobody can fix something he can't see acting ------------------------------------------------------------------------ [2017-10-12 17:40:51] vasilios at betoglou dot com I'm going to give you the benefit of the doubt in your slightly hostile response based on semantics of the "simply wrong" summary title (raising above x value, or disabling - raising to infinite value - causes an issue). Is this a show stopper into confirming or explaining the issue I am seeing? ------------------------------------------------------------------------ [2017-10-12 17:24:04] spam2 at rhsoft dot net than "Raising memory_limit causes script to fail with no error" is simply wrong because -1 disbales memory_limit ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=75366 -- Edit this bug report at https://bugs.php.net/bug.php?id=75366&edit=1

« previous php.bugs (#211660) next »