Worker stopped due to time limit of x exceeded

Running messenger:consume workers with a time limit can be useful, but you should also not set it too low.

375 views
d

By. Jacob

Edited: 2022-11-11 02:00

10:09:14 INFO [messenger] Worker stopped due to time limit of 300s exceeded
[
  "timeLimit" => 300
]

This happens when you run a messenger:consume worker with a time limit like --time-limit=1800.

You do not have to worry about messages not being handled properly, since the time limit parameter specifically makes sure that the currently processing message finishes before the worker is stopped.

You should use supervisor, or a similar tool, to handle your messenger:consume workers, because then you can make them automatically restart when stopped.

Running messenger:consume or scheduled-task:run from cron is not recommended, as it they will be harder to manage.

Shopware messenger:consume settings

Shopware uses the Symfony Messenger component, and Shopware 6 recommends PHP at least has 512MB available memory, so you should consider starting your workers with a minimum of 512MB, and perhaps even more, since your workers should not normally reach the memory limit. But it may be nice with some leverage, so running with 1024MB probably does no harm.

If you are experiencing problems running your workers, it can sometimes help to run an extra worker with the -vvv option in order to see potential errors live in a terminal:

sudo -u www-data bin/console messenger:consume --memory-limit=1024M --time-limit=1800 -vvv

Tell us what you think:

  1. How to debug issues caused by corrupted custom fields in Shopware 6.
  2. Sometimes we may to manually clear cached Shopware files to fix namespace issues.
  3. How to obtain the currently selected API language from Shopware vue components.
  4. How to access file system paths from storefront twig files in Shopware.
  5. How to get or change the currently selected sales channel in an Shopware sw-sales-channel-switch component.

More in: Shopware