简体   繁体   English

Symfony 信使不会总是重新启动

[英]Symfony messenger won't always restart

I'm currently working on a Symfony 4 application which use Symfony Messenger to handle some background jobs with a dedicated worker.我目前正在开发一个 Symfony 4 应用程序,该应用程序使用Symfony Messenger与专门的工作人员一起处理一些后台作业。

I run the worker using systemd v241 with the following configuration:我使用具有以下配置的 systemd v241 运行工作程序:

[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.正如文档中所写,worker 不能永远运行,所以它每小时或每次达到 memory 限制 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.有时会,但有时不会,我唯一得到的是Main process exited, code=killed, status=15/TERM在我的日志中。

Any idea why and how to solve this?知道为什么以及如何解决这个问题吗?

Lingering weren't enable on the user responsible of starting the service.负责启动服务的用户未启用延迟 Enabling it has solved my issue.启用它解决了我的问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM