语境

语境

语境

我有一个 systemd 服务。(我contrail-vrouter-dpdk.service自己编写了该文件,如下所示。)

当我运行时sudo systemctl is-active contrail-vrouter-dpdk它显示“正在停用”。

当我跑步时sudo systemctl status contrail-vrouter-dpdk说:

Active: deactivating (stop-sigterm) since Fri 2019-04-26 15:28:49 AEST; 39min ago

(完整输出如下)

当我运行时,sudo systemctl kill contrail-vrouter-dpdk它立即返回,返回代码为零,没有打印任何内容。但状态保持不变。

当我运行systemctl start(或restart)时,它会永远挂起,没有输出。

当我尝试重新启动计算机时,关机挂起,等待此服务停用。我必须强制关闭电源才能真正重新启动它。

问题

如果 systemd 进程卡在 上,我该如何重新启动它deactivating?为什么实际上没有kill终止该进程?

详细信息

systemctl status

● contrail-vrouter-dpdk.service - Contrail vrouter dpdk service
   Loaded: loaded (/etc/systemd/system/contrail-vrouter-dpdk.service; enabled; vendor preset: enabled)
   Active: deactivating (stop-sigterm) since Fri 2019-04-26 15:28:49 AEST; 39min ago
 Main PID: 5517 (contrail-vroute)
    Tasks: 8 (limit: 12287)
   CGroup: /system.slice/contrail-vrouter-dpdk.service
           ├─5517 [contrail-vroute]
           └─5534 /home/ubuntu/src/vrouter/build/production/vrouter/dpdk/contrail-vrouter-dpdk --no-daemon --socket-mem 1024 1024

Apr 26 15:26:14 dell01 contrail-vrouter-dpdk[5517]: 2019-04-26 15:26:14,428 VROUTER:     lcore 10 RX from HW queue 1
Apr 26 15:28:49 dell01 systemd[1]: Stopping Contrail vrouter dpdk service...
Apr 26 15:28:49 dell01 contrail-vrouter-dpdk[5517]: 2019-04-26 15:28:49,315 VROUTER: Got signal 15 on lcore 0, stopping...
Apr 26 15:28:49 dell01 contrail-vrouter-dpdk[5517]: 2019-04-26 15:28:49,339 VROUTER: Releasing KNI devices...
Apr 26 15:28:49 dell01 contrail-vrouter-dpdk[5517]: 2019-04-26 15:28:49,339 VROUTER: Releasing TAP devices...
Apr 26 15:28:49 dell01 contrail-vrouter-dpdk[5517]: 2019-04-26 15:28:49,339 VROUTER: Closing eth devices...
Apr 26 15:28:49 dell01 contrail-vrouter-dpdk[5517]: 2019-04-26 15:28:49,354 VROUTER: Got signal 15 on lcore 0, stopping...
Apr 26 15:53:50 dell01 contrail-vrouter-dpdk[5517]: 2019-04-26 15:53:50,790 VROUTER: Got signal 15 on lcore 4294967295, stopping...

contrail-vrouter-dpdk.service

[Unit]
Description=Contrail vrouter dpdk service
After=network.target
#Wants=contrail-vrouter-agent.service

[Service]
Type=simple
ExecStart=/home/ubuntu/src/vrouter/build/production/vrouter/dpdk/contrail-vrouter-dpdk --no-daemon --socket-mem 1024,1024
TimeoutStartSec=240
TimeoutStopSec=0
Restart=always
ExecStop=/bin/kill -s TERM $MAINPID
PrivateTmp=yes
ProtectHome=no
ExecStartPre=/opt/contrail/bin/vrouter-pre-start.sh
ExecStartPost=/opt/contrail/bin/vrouter-post-start.sh
ExecStopPost=/opt/contrail/bin/vrouter-post-stop.sh
ReadWriteDirectories=-/var/log/contrail
ReadWriteDirectories=-/var/lib/contrail
ReadWriteDirectories=-/var/crashes
ReadWriteDirectories=-/var/run
ReadWriteDirectories=-/dev
LimitCORE=infinity
StandardOutput=syslog
StandardError=syslog
SyslogIdentifier=contrail-vrouter-dpdk
User=root
CPUAffinity=2,3

[Install]
WantedBy=multi-user.target

答案1

# systemctl status logstash.service
● logstash.service - logstash
   Loaded: loaded 
  Drop-In: /etc/systemd/system/logstash.service.d
   Active: deactivating (stop-sigterm)
 Main PID: 20410 (java)
   CGroup: /system.slice/logstash.service
           └─20410 /usr/bin/java

我通过终止与主 PID 相关的进程解决了该问题:

# kill -9 20410 

相关内容