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.

140 views

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:

  1. Sometimes we may to manually clear cached Shopware files to fix namespace issues.
  2. How to obtain the currently selected API language from Shopware vue components.
  3. How to access file system paths from storefront twig files in Shopware.
  4. How to get or change the currently selected sales channel in an Shopware sw-sales-channel-switch component.
  5. In this tutorial you will learn how to work with Shopware entities in a generic way from PHP, without having to specifically inject the repository in your services.xml file.

More in: Shopware