Reputation: 3173
I'm currently working on a Symfony 4 application which use Symfony Messenger to handle some background jobs with a dedicated worker.
I run the worker using systemd v241 with the following configuration:
[Unit]
Description=Symfony Worker
StartLimitIntervalSec=0
StartLimitBurst=0
[Service]
WorkingDirectory=/symfony-app/current
ExecStart=/bin/bash -lc 'bin/console messenger:consume async --memory-limit=512M --time-limit=3600'
ExecStop=/bin/bash -lc 'bin/console messenger:stop-workers'
StandardOutput=syslog
StandardError=syslog
Restart=always
PrivateTmp=true
NoNewPrivileges=true
RestartSec=5s
[Install]
WantedBy=default.target
As written in the documentation, the worker must not run forever so it restart every hour or every time it reach the memory limit of 512M.
My problem is that it doesn't always restart. Sometimes it does but sometimes it doesn't and the only thing I get is a Main process exited, code=killed, status=15/TERM
in my logs.
Any idea why and how to solve this?
Upvotes: 1
Views: 1033