PHP Keeps running out of memory

Hi all,

We keep getting errors relating to memory limits in php as seen below. No matter how much memory we give PHP (memory_limit) it doesn’t have enough. We have tried up to 4Gb. This appears when we try access the calendar from thunderbird but may also occur in other circumstances. We just notice the issue when the caldav would not sync.

This occurs with php-fcgi or normal apache php. We are using PHP 7.4

[Fri Nov 27 08:39:35.341345 2020] [proxy_fcgi:error] [pid 10700] [client 156.155.46.214:2491] AH01071: Got error ‘PHP message: PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 262144 bytes) in /var/www/nextcloud/apps/mail/lib/IMAP/Threading/Container.php on line 111PHP message: PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 262144 bytes) in Unknown on line 0’
[Fri Nov 27 08:40:16.416240 2020] [proxy_fcgi:error] [pid 9948] [client 156.155.46.214:58602] AH01071: Got error ‘PHP message: PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 262144 bytes) in /var/www/nextcloud/apps/mail/lib/IMAP/Threading/Container.php on line 111PHP message: PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 262144 bytes) in Unknown on line 0’
[Fri Nov 27 08:40:19.861500 2020] [proxy_fcgi:error] [pid 10359] [client 156.155.46.214:34837] AH01071: Got error ‘PHP message: PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 262144 bytes) in /var/www/nextcloud/apps/mail/lib/IMAP/Threading/Container.php on line 111PHP message: PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 262144 bytes) in Unknown on line 0’
[Fri Nov 27 08:41:00.443718 2020] [proxy_fcgi:error] [pid 10408] [client 156.155.46.214:24823] AH01071: Got error ‘PHP message: PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 262144 bytes) in /var/www/nextcloud/apps/mail/lib/IMAP/Threading/Container.php on line 111PHP message: PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 262144 bytes) in Unknown on line 0’
[Fri Nov 27 08:41:05.089508 2020] [proxy_fcgi:error] [pid 10857] [client 156.155.46.214:51187] AH01071: Got error ‘PHP message: PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 262144 bytes) in /var/www/nextcloud/apps/mail/lib/IMAP/Threading/Container.php on line 111PHP message: PHP Fatal error: Allowed memory size of 1073741824 bytes exhausted (tried to allocate 262144 bytes) in Unknown on line 0’

1 GB is not 4 GB. I think you set your limit at the wrong position.

Read also
https://docs.nextcloud.com/server/20/admin_manual/installation/server_tuning.html

Is there another PHP version installed and perhaps activated?

thanks for the link @devnull - The log report was from when we set the memory_limit to 1g; we get the same result when its set to 4g but, of course, the total is reported differently.