129 Star 0 Fork 14

src-openEuler / libvma

 / 详情

【21.03】vma服reload后,状态变成inactive

已验收
缺陷
创建于  
2021-03-05 17:34

【环境信息】
硬件信息:
1) 虚拟机 内存:4 GiB vCPU:1
软件信息:
openeulerversion=openEuler-21.03
compiletime=2021-02-23-17-45-36
gccversion=9.3.1-20210204.16.oe1
kernelversion=5.10.0-2.0.0.11.oe1
openjdkversion=1.8.0.282.b08-5.oe1
arch:arm x86
【问题复现步骤】
1、systemctl start vma
2、systemctl reload vma
出现概率:必现
【预期结果】
reload后的服务状态为active
【实际结果】
reload后的服务状态为inactive
【附件信息】
比如系统message日志/组件日志、dump信息、图片等
输入图片说明

评论 (3)

street_dust 创建了缺陷
street_dust 关联仓库设置为src-openEuler/libvma
展开全部操作日志

Hey street_dust, Welcome to openEuler Community.
All of the projects in openEuler Community are maintained by @openeuler-ci-bot.
That means the developers can comment below every pull request or issue to trigger Bot Commands.
Please follow instructions at https://gitee.com/openeuler/community/blob/master/en/sig-infrastructure/command.md to find the details.

street_dust 负责人设置为sherlock2010
street_dust 关联分支设置为openEuler-21.03
street_dust 里程碑设置为openEuler 21.03-RC1
street_dust 计划截止日期设置为2021-03-06
street_dust 计划开始日期设置为2021-03-05
street_dust 计划截止日期2021-03-06 修改为2021-03-11
street_dust 置顶等级设置为
street_dust 置顶等级 修改为
street_dust 优先级设置为主要
street_dust 负责人sherlock2010 修改为small_leek
street_dust 修改了描述

问题分析
这个问题历史版本就存在,reload其实执行的是restart,restart命令先执行stop,再执行start

  • vma.service
……
[Service]
Type=forking
Restart=on-failure
ExecStart=@prefix@/sbin/vma start
ExecStop=@prefix@/sbin/vma stop
ExecReload=@prefix@/sbin/vma restart
RestartForceExitStatus=1 SIGTERM
……
  • /usr/sbin/vma
……
function do_restart()
{
    do_stop
    do_start
}
……
case "$1" in
    start)
        do_check
        do_start
        ;;
    stop)
        do_check
        do_stop
        ;;
    status)
        do_status
        ;;
    restart | force-reload)
        do_check
        do_restart
        ;;
    *)
……

参考:
https://github.com/Mellanox/libvma/blob/5f3329b1ec20801785136d303e489644fcf330d5/contrib/scripts/vma.service.in
https://github.com/Mellanox/libvma/blob/5f3329b1ec20801785136d303e489644fcf330d5/contrib/scripts/vma.init.in

解决思路

  1. 通过先systemctl stop vma,再systemctl start vma模拟reload,服务操作正常
  2. systemctl reload vma,多执行了一次stop
[root@localhost ipsec.d]# systemctl start vma
[root@localhost ipsec.d]# systemctl status vma
● vma.service - VMA Daemon. Version: 8.9.4-0
     Loaded: loaded (/usr/lib/systemd/system/vma.service; enabled; vendor preset: disabled)
     Active: active (running) since Mon 2021-03-08 18:45:33 CST; 5s ago
    Process: 51017 ExecStart=/usr/sbin/vma start (code=exited, status=0/SUCCESS)
   Main PID: 51023 (vmad)
      Tasks: 1 (limit: 1428)
     Memory: 1.9M
     CGroup: /system.slice/vma.service
             └─51023 /usr/sbin/vmad

3月 08 18:45:32 localhost.localdomain systemd[1]: Starting VMA Daemon. Version: 8.9.4-0...
3月 08 18:45:33 localhost.localdomain vma[51017]: Starting vmad: [  OK  ]
3月 08 18:45:33 localhost.localdomain systemd[1]: Started VMA Daemon. Version: 8.9.4-0.
[root@localhost ipsec.d]# systemctl reload vma
[root@localhost ipsec.d]# systemctl status vma
● vma.service - VMA Daemon. Version: 8.9.4-0
     Loaded: loaded (/usr/lib/systemd/system/vma.service; enabled; vendor preset: disabled)
     Active: inactive (dead) since Mon 2021-03-08 18:45:51 CST; 1s ago
    Process: 51017 ExecStart=/usr/sbin/vma start (code=exited, status=0/SUCCESS)
    Process: 51029 ExecReload=/usr/sbin/vma restart (code=exited, status=0/SUCCESS)
    Process: 51040 ExecStop=/usr/sbin/vma stop (code=exited, status=0/SUCCESS)
   Main PID: 51023 (code=exited, status=0/SUCCESS)

3月 08 18:45:32 localhost.localdomain systemd[1]: Starting VMA Daemon. Version: 8.9.4-0...
3月 08 18:45:33 localhost.localdomain vma[51017]: Starting vmad: [  OK  ]
3月 08 18:45:33 localhost.localdomain systemd[1]: Started VMA Daemon. Version: 8.9.4-0.
3月 08 18:45:48 localhost.localdomain systemd[1]: Reloading VMA Daemon. Version: 8.9.4-0.
3月 08 18:45:49 localhost.localdomain vma[51029]: Shutting down vmad: [  OK  ]
3月 08 18:45:49 localhost.localdomain vmad[51037]: [INFO  ] Starting
3月 08 18:45:50 localhost.localdomain vma[51029]: Starting vmad: [  OK  ]
3月 08 18:45:51 localhost.localdomain vma[51040]: Shutting down vmad: [  OK  ]
3月 08 18:45:51 localhost.localdomain systemd[1]: vma.service: Succeeded.
3月 08 18:45:51 localhost.localdomain systemd[1]: Reloaded VMA Daemon. Version: 8.9.4-0.

vma[51029]先执行stop,然后执行start,之后vma[51040]又执行了stop
多执行的stop,目前未找到原因……

解决方法:
21.03分支PR:!7:Remove ExecReload that is not supported

systemctl reload官方用法是加载服务自身的配置文件,比如xxx.conf、xxxrc,这里的reload按照restart的用法做了,而restart本身就存在,一是重复,二是用法不合理,三是这个命令有问题。
目前libvma本身没有加载配置文件的机制,即不支持这个功能,所以移除。

参考reload官方定义如下 :
reload PATTERN…

Asks all units listed on the command line to reload their configuration.
Note that this will reload the service-specific configuration, not the unit configuration file of systemd.
If you want systemd to reload the configuration file of a unit, use the daemon-reload command.
In other words: for the example case of Apache, this will reload Apache's httpd.conf in the web server, not the apache.service systemd unit file.
This command should not be confused with the daemon-reload command.

https://www.freedesktop.org/software/systemd/man/systemctl.html

备注:其它发行版皆是不支持reload命令的

验证结果:

[root@localhost ipsec.d]# systemctl start vma
[root@localhost ipsec.d]# systemctl status vma
● vma.service - VMA Daemon. Version: 8.9.4-0
     Loaded: loaded (/usr/lib/systemd/system/vma.service; enabled; vendor preset: disabled)
     Active: active (running) since Wed 2021-03-10 10:33:50 CST; 1s ago
    Process: 58587 ExecStart=/usr/sbin/vma start (code=exited, status=0/SUCCESS)
   Main PID: 58593 (vmad)
      Tasks: 1 (limit: 1428)
     Memory: 2.0M
     CGroup: /system.slice/vma.service
             └─58593 /usr/sbin/vmad

3月 10 10:33:49 localhost.localdomain systemd[1]: Starting VMA Daemon. Version: 8.9.4-0...
3月 10 10:33:49 localhost.localdomain vmad[58592]: [INFO  ] Starting
3月 10 10:33:50 localhost.localdomain vma[58587]: Starting vmad: [  OK  ]
3月 10 10:33:50 localhost.localdomain systemd[1]: Started VMA Daemon. Version: 8.9.4-0.
[root@localhost ipsec.d]# systemctl reload vma
Failed to reload vma.service: Job type reload is not applicable for unit vma.service.

登录 后才可以发表评论

状态
负责人
项目
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
预计工期 (小时)
参与者(3)
5329419 openeuler ci bot 1632792936
1
https://gitee.com/src-openeuler/libvma.git
git@gitee.com:src-openeuler/libvma.git
src-openeuler
libvma
libvma

搜索帮助