【环境信息】
cat /etc/openEuler-latest
openeulerversion=openEuler-20.03-LTS-SP3
compiletime=2021-11-22-21-37-44
gccversion=7.3.0-20210628.42.oe1
kernelversion=4.19.194-2106.1.0.0088.oe1
openjdkversion=1.8.0.312.b07-5.oe1
【问题复现步骤】
cp /usr/share/doc/ldirectord/ldirectord.cf /etc/ha.d/
systemctl start ldirectord
systemctl status ldirectord
出现概率(是否必现,概率性错误):偶现
【预期结果】
服务启动后没有该错误日志
【实际结果】
服务启动后出现该错误日志
【附件信息】
比如系统message日志/组件日志、dump信息、图片等
Hi erin_dan, welcome to the openEuler Community.
I'm the Bot here serving you. You can find the instructions on how to interact with me at
https://gitee.com/openeuler/community/blob/master/en/sig-infrastructure/command.md.
If you have any questions, please contact the SIG: Others, and any of the maintainers: @jimmy_hero, @small_leek.
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。
问题原因:
systemd会在中间父进程退出后立即读取PID文件,读取成功后就认为该服务已经启动成功。但是,systemd读取PIDFile的时候,服务主进程可能还未将PID写入到PID文件中,这时systemd将出现问题,此issue现象正是因为systemd在ldirectord写入PID文件之前先去读取了PID文件,因为没有读取到内容,所以报错。
解决方法:
解决办法是使用ExecStartPost=/usr/bin/sleep 0.1,让systemd在初始化进程(即中间父进程)退出之后耽搁0.1秒再继续向下执行,即推迟了systemd读取PID的过程,保证能让systemd从PID文件中读取到值
验收通过:
登录 后才可以发表评论