[php-src] Issue #8116: PHP 8.1 Failed to set memory limit to ... bytes (Current memory usage is ... bytes)
| From: | brainfoolong | Date: | Fri, 18 Feb 2022 05:37:50 +0000 |
| Subject: | [php-src] Issue #8116: PHP 8.1 Failed to set memory limit to ... bytes (Current memory usage is ... bytes) | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-239863@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/8116
Author: brainfoolong
### Description
Hi!
We recently upgraded to PHP 8.1 and now we sporadically get this kind of new errors:
Failed to set memory limit to 536870912 bytes (Current memory usage is 870318080 bytes)
The problem is, the memory usage cannot be that high at that moment, because we use
ini_set on the very start of the script, where almost nothing happened.
Furthermore, we can call the same page 100x times, the error does not appear, but sometime, it
happens. It is impossible to reproduce. It definitely only is on PHP 8.1 - With PHP 8.0 we never had
this kind of issues.
I guess that the system has sometimes wrong internal memory usage stats, maybe from another thread
on the same system?
Is there something we can do about it, without just error suppressing or try/catch?
We are on Windows Server, with Apache 2.4.52 and PHP 8.1.2 TSx64.
As said above, unfortunately i have no reproducible example, but the code that throw the error is
this line
ini_set("memory_limit", "512M");
### PHP Version
PHP 8.1.2 TSx64
### Operating System
Windows Server 2019