-
-
Notifications
You must be signed in to change notification settings - Fork 9.6k
Not enough reserved memory in debug component's ErrorHandler #26893
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Would you like opening a PR doing so? Doubling the amount of reserved memory looks reasonable to me (did you try any lower value btw?) |
I've been trying a few different values and I'm actually seeing very inconsistent results. Making the same request sometimes works with as low as 10240 reserved bytes but sometimes even 64K isn't enough to make it all the way through the I'm reluctant to open a PR without understanding why requests are varying so much in terms of memory usage when they are ostensibly identical, so I will try to set up a simple, reproducible example using a fresh clone first. |
Could you also check if calling gc_collect_cycles() while releasing the reserved memory helps? |
@krixon shall we close then? |
Sorry, I haven't had time to progress this. I am happy to close, I will reopen if I get to a point where I can reproduce this reliably. |
Hi, i am using PHP 5.3.3 and loading exception for OutOfMemory exceeds reservedMemory variable, the following snippets prints in my server 46368, look at this example: $a = memory_get_usage();
include_once 'vendor/symfony/debug/Symfony/Component/Debug/Exception/FatalErrorException.php';
include_once 'vendor/symfony/debug/Symfony/Component/Debug/Exception/OutOfMemoryException.php';
$c = new \Symfony\Component\Debug\Exception\OutOfMemoryException("dummy",1,1,1,1,1);
$b = memory_get_usage();
var_dump($b- $a); // it prints 46368 bytes
exit;
I have tried to extend the class and init my own reserved memory with no luck as the ErrorHandler class registers the shutdown function in a no extendable way register_shutdown_function(__CLASS__.'::handleFatalError'); My ugly solution is copy the all ErrorHandler class and add my own constant :( self::$reservedMemory = str_repeat('x', MEMORY_RESERVED_ERROR_HANDLER); |
I have created a pull request symfony/debug#8 |
Hi all, this should get fixed in symfony 4.4 soon, as there is a merged in PR for that #44327 |
Upon reaching the configured memory_limit, I get a fatal error from the Debug component as it tries to handle the error. For example:
I can fix this by increasing the amount of reserved memory in
Symfony\Component\Debug\ErrorHandler
:This allows the error handling process to complete and the OutOfMemoryException is thrown as expected, but there is currently no way to configure this value.
The text was updated successfully, but these errors were encountered: