Since the release of 5.10 I’ve found that I need to set my php.ini → memory_limit to a larger value (>1G) in order for the update to go through.
a) Is this expected behaviour?
b) Figuring out that the memory limit was the problem was… not easy. Would there be a way to make the error messages more helpful when the memory runs out?
The memory requirement can be related to how large the change is, for example going from 5.9.0 to 5.10.0 may require a lot memory but from 5.10.0 to 5.10.1 may require less.
For what it’s worth, I’ve had mine set at 1gb for 18 months and never had any problems with it.
One thing I’d note, based on other PHP based programs I’ve used. It depends on whether or not you’re using php-fpm. I’ve had instances where adjusting the memory settings in one but not the other, still throws the insufficient memory error.
It’s only the actual update process that runs out of memory. Once the update is complete I can go back to 1G with no problems.
Here’s what I observe:
Updating from the interface fails w/ a generic Error 500
laravel.log contains no errors
worker.log contains no errors
nginx error.log contains no errors
php-fpm.log contains no errors
supervisord.log contains no errors
/var/log/messages (syslog) contains errors as follows:
invoiceninja php[29913]: PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 36864 bytes) in /var/www/invoiceninja/app/Http/Controllers/SelfUpdateController.php on line 88
invoiceninja php[29913]: PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 32768 bytes) in /var/www/invoiceninja/app/Exceptions/Handler.php on line 243
invoiceninja php[29913]: PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 36864 bytes) in Unknown on line 0
That gave me just enough info to track down the php.ini memory limit as the problem
Update: same issue when updating 5.10.10 → 5.10.13
I’m probably going to be migrating to a docker install at some point in the near-ish future, so this may become a non-issue for me at that point. It’s a big migration though, so I need to find the time first.
I still think that running out of memory should display an error message to that effect though, rather than simply error 500. I may open a github issue to that effect.
Interesting. I just updated to 5.10.13 and it went quickly and smoothly, without any issues. It used just over 500mb during the process. Not including making a backup, the whole process only took 3 or 4 minutes.
Just out of curiosity, do mind sharing your update process? I’m curious to see if it’s different and/or how it compares to the process that I use. I’m interested to try and duplicate what is happening for you.
Are you increasing your memory limit in your ini file for php or php-fpm?
I click on the little icon that pops up in the flutter ui when there’s an update, then I click update now.
After verifying my password, it gives me a pop-up that says “Error 500:” with no further info.
So then I go into my php.ini and increase the memory limit to 2G, then restart the relevant services.
Then I do the same process again and it works perfectly.
Then, once the update is complete, I reset my php.ini memory limit to 1G and I once again restart the relevant services, and the app continues to function normally (until the next update, at which point the process repeats)
php.ini is the base settings for php which, as far as I can tell, get inherited by php-fpm.
However, I have narrowed down the “relevant services” mentioned above to be just php-fpm.
I haven’t tried an update from the command line. Perhaps I’ll give that a go for the next update (if I remember lol)
I’m not a PHP programmer, so I could be completely incorrect here. However, reading the PHP manual, I do not interpret it that way. Yes, php-fpm uses the same syntax for the config, but I believe that it needs to be set separately from the general php.ini.
You may wish to manually change your php-fpm settings to match your general php.ini and restart php-fpm. You may find that your problem disappears. I manually set both of mine and haven’t had any issues. Several install guides online (not associated with InvoiceNinja) recommend doing the above. That would be a lot easier and faster than migrating to docker.