Worker stopped due to memory limit of x bytes exceeded
This problem can occur when you have a typo in the memory-limit part of your messenger:consume call.
Edited: 2022-10-18 13:34
12:37:21 INFO [messenger] Worker stopped due to memory limit of 1024 bytes exceeded (44564480 bytes used)
This error can show up when messenger:consume is called with a typo in the --memory-limit part of the command, and it might not be easy to track down when controlling your workers with supervisor.
When specifying a memory limit, always remember include a size unit at the end. M for megabytes is most often used. If no size unit is present, bytes is assumed, resulting in the limit of x bytes exceeded error.
You ought to pick a memory limit that at least matches the minimum requirements of your application. For Shopware 6 this is 512M.
When using supervisor, an obvious symptom is that the individual processes will exit very quickly, or they might continuously restart, with little indication as to what is going on.
A working messenger-consume.conf for supervisor might look like this:
command=php /var/www/shopware/bin/console messenger:consume default --time-limit=600 --memory-limit=1024M
user=www-data
numprocs=2
autostart=true
autorestart=true
process_name=%(program_name)s_%(process_num)02d
This should be placed in /etc/supervisor/conf.d/.
Tell us what you think: