Open stafra opened 2 months ago
Hi @stafra! Thanks a lot for the well structured report and the debugging you've already done.
We have seen some similar out of memory errors in production recently. Unfortunately they are often tricky to diagnose because the PHP process ends abruptly with no stack trace.
Would you be willing to gather more debug information with our guidance? We can run the same CLI sync with xdebug trace and hopefully see where memory is not freed.
I will be happy to help with debugging. :-)
/usr/bin/php -d zend_extension=xdebug -d xdebug.mode=trace -d xdebug.start_with_request=yes -d xdebug.output_dir=/tmp occ mail:account:sync -vvv 3
(might need adjustment for snap. basically you run the occ php script with some options for the php interpreter)It should be somewhat human readable. As an alternative, you could also try the machine readable one with the helper script: https://stackoverflow.com/questions/36266376/how-do-i-use-xdebug-to-find-a-php-memory-leak
My Nextcloud system is running in "snap", which does not allow direct execution of the php binary. Running xdebug from the host system is not possible, "occ" is not a php script, but a link to the snap:
root@nextcloud:~# ls -l /snap/bin/nextcloud.occ
lrwxrwxrwx 1 root root root 13 Sep 18 09:59 /snap/bin/nextcloud.occ -> /usr/bin/snap
The snap installation doesn't include the xdebug extension and it's not possible to install it (I don't know how to). I feel that my system is not debugging friendly and that I will not be able to deliver the required outputs. Sorry for that.
No worries
Steps to reproduce
Expected behavior
The sync process should take resonable amount of memory.
Actual behavior
The sync process dies on low memory even if a huge swap used:
Memory limit is set realy high (I just tried a ridiculously high limit):
root@nextcloud:~# snap set nextcloud php.memory-limit=284G
After repetated run the mailbox seems to be synced - but I am not sure if it is fully synced and if I can trust it in the future. I'll need to do fresh resync in the future (we will migrate our mail domain to a private solution I'm testing) and I don't want to do this workaround with a huge swap.
Mail app version
3.7.8
Mailserver or service
Dovecot 2.3.16 (on premise)
Operating system
Ubuntu 24.04.1 LTS
PHP engine version
PHP 8.2
Web server
Apache (supported)
Database
MySQL
Additional info
No response