skip to Main Content

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


  1. Chosen as BEST ANSWER

    I found out a solution. But Idk why it works.

    1. I had several commands to cache some things. Everything works fine when I called it one by one.
    2. Then I had an idea to create a command to unify all calls and I can call just one command and that command should call all others. That was the problem. (IDK Why)

    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.


  2. 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".

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search