Firstly I got this error in console:
PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 20480 bytes) in /home/vagrant/Projects/yieldbow/vendor/symfony/console/Input/ArrayInput.php on line 170
PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 20480 bytes) in /home/vagrant/Projects/yieldbow/vendor/laravel/framework/src/Illuminate/Foundation/Bootstrap/HandleExceptions.php on line 203
After that I increase memory limit, but even after that I got the same error.
Two days ago, everything works fine. Now I just added another command to call multiple commands from there and everything crashed. I can’t even call commands one by one.
Because of memory leakage I comment out all code that I hade in command. But nothing works, every time I have that error or just error: Killed (probably process)
Very strange behaviour, is there someone who can explain me this?
P.S. I’m using Spatie/Multitenancy package.
2
Answers
I found out a solution. But Idk why it works.
So I had something like this: command:first, command:second, command:third.
When I call it from artisan one by one everything was fine.
(PHP artisan command:first,second,third... --tenant=123)
But, when I create "main command" : command:main
When I call it from artisan -> PHP artisan command:main --tenant=123 I got previous error. Why? I don't have fucking clue...
Maybe it's something about Spatie package, idk. Right now, I do not have time to investigate that.
this error may happen in case of infinit loops, loops can be simple like
for
or maybe loop of dependencies injcetion for example if you have a class A which use class B in constructor and the class B also use class A i constructor. in these cases php may crash with the error : "Allowed memory size exhausted".