Bug #75366 [Opn->Csd]: Raising memory_limit causes script to fail with no error.
| From: | vasilios at betoglou dot com | Date: | Thu, 12 Oct 2017 20:07:51 +0000 |
| Subject: | Bug #75366 [Opn->Csd]: Raising memory_limit causes script to fail with no error. | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-211658@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
User updated by: vasilios at betoglou dot com
Reported by: vasilios at betoglou dot com
Summary: Raising memory_limit causes script to fail with no
error.
-Status: Open
+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:
I'll figure a workaround using PHP native commands - thanks for the feedback.
Previous Comments:
------------------------------------------------------------------------
[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
------------------------------------------------------------------------
[2017-10-12 17:21:21] vasilios at betoglou dot com
I've tried it with -1 with the same results. This isn't really an issue with OOM, which
is expected. This is an issue where memory_limit is above x value, the script dies silently and no
errors are logged.
------------------------------------------------------------------------
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