Bug #75366 [NEW]: Raising memory_limit causes script to fail with no error.
| From: | vasilios at betoglou dot com | Date: | Thu, 12 Oct 2017 16:56:06 +0000 |
| Subject: | Bug #75366 [NEW]: Raising memory_limit causes script to fail with no error. | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-211646@lists.php.net to get a copy of this message | ||
From: vasilios at betoglou dot com
Operating system: Linux helios 4.4.0-89-generic #1
PHP version: 7.0.24
Package: Reproducible crash
Bug Type: Bug
Bug description:Raising memory_limit causes script to fail with no error.
Description:
------------
I have a script that searches through files on the local system for a
particular string and returns the results. The form page does an ajax
call to the function page. This uses shell_exec to run the command
locally.
If, while the command is running, the results get too large, an error
like this is thrown:
[Thu Oct 12 12:21:49.963798 2017] [:error] [pid 16001] [client
172.19.32.179:50338] PHP Fatal error: Allowed memory size of 41943040
bytes exhausted (tried to allocate 23068704 bytes) in
/var/www/html/wp-content/themes/twentyfourteen-child/results.php on line
28, referer: https://<url>/metadata-search/
I upped the memory limit from 512M to 1024M I get an OOM error. I upped
the limit to 2048M, no error is logged, but the script just stops as if
it had crashed. Any value above ~1400M seems to be causing this issue,
where the script returns no results and nothing is logged.
If I search for a term that returns smaller results, everything works
fine:
(find command run CLI for example as to what the script is dealing
with)
<user>@<host>:~$ find /home/metadata/arl.data/arlindex.xml -type f |
xargs grep -E 'host' /dev/null -nr |wc -l
863439 > OOM with memory_limit < ~1400M, script just dies if > ~1400M,
no error thrown.
<user>@<host>:~$ find /home/metadata/arl.data/arlindex.xml -type f |
xargs grep -E 'betoglo' /dev/null -nr |wc -l
11 > WORKS FINE
Test script:
---------------
$cmd="find $directory$filename -type f | xargs grep -E '$terms' $range
/dev/null -nr";
$link=shell_exec($cmd);
Expected result:
----------------
I expect to see an OOM error or correct results.
Actual result:
--------------
I see no OOM error in /var/log/apache/error.log, the script dies with no
results.
--
Edit bug report at https://bugs.php.net/bug.php?id=75366&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=75366&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=75366&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=75366&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=75366&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=75366&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=75366&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=75366&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=75366&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=75366&r=support
Expected behavior: https://bugs.php.net/fix.php?id=75366&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=75366&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=75366&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=75366&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=75366&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=75366&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=75366&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=75366&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=75366&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=75366&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=75366&r=mysqlcfg