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

From: Date: Thu, 12 Oct 2017 17:05:36 +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-211647@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: Open 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: memory_limit = -1 at least try if it makes any difference (and when you deal with many hundret MB for a single rqeuest the memory limit is useless anyway because some requests parallel would blow away the machine in any case) then you have timeouts and so on.... the application is broken by design using that much resources and shell_exec() raises a red flag for a webserver Previous Comments: ------------------------------------------------------------------------ [2017-10-12 16:55:57] vasilios at betoglou dot com 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 this bug report at https://bugs.php.net/bug.php?id=75366&edit=1

« previous php.bugs (#211647) next »