ITPub博客

首页 > 自动化运维 > 大规模网络运维 > [20191225]ntpd sendto(192.168.xxx.x) (fd=-1) Bad file descriptor.txt

[20191225]ntpd sendto(192.168.xxx.x) (fd=-1) Bad file descriptor.txt

原创 大规模网络运维 作者:lfree 时间:2019-12-25 11:48:12 0 删除 编辑

[20191225]ntpd sendto(192.168.xxx.x) (fd=-1) Bad file descriptor.txt

--//今天使用rsyslog集中管理syslog日志,发现一台机器一些异常(主要发现该日志文件比别的机器大许多):
 # grep "Bad file descriptor" *.log  | tail -3
192.168.xxx.xxx_syslog.log:Dec 25 11:28:06 xxxxxxxxxx ntpd[93269]: sendto(192.168.yyy.yyy) (fd=-1): Bad file descriptor
192.168.xxx.xxx_syslog.log:Dec 25 11:28:22 xxxxxxxxxx ntpd[93269]: sendto(192.168.yyy.yyy) (fd=-1): Bad file descriptor
192.168.xxx.xxx_syslog.log:Dec 25 11:28:39 xxxxxxxxxx ntpd[93269]: sendto(192.168.yyy.yyy) (fd=-1): Bad file descriptor

--//检索发现如下链接:https://www.cyberciti.biz/faq/bad-file-descriptor-ntpd-error/
--//里面有1个提示:
A. If you are seeing Bad file descriptor errors in /var/log/messages, make sure that only one instance of ntpd is running.

# ps -ef | grep  nt[p]
ntp       24786      1  0 11:25 ?        00:00:00 ntpd -u ntp:ntp -p /var/run/ntpd.pid -x
root      93269      1  0  2015 ?        00:54:17 ntpd

--//很明显启动2个,而且有1个不知道那个家伙在命令行上输入的.执行的是ntpd(执行用户是root),我自己手工模拟一次.

# ntpd
# ps -elf | grep  nt[p]
5 S ntp       24786      1  0  80   0 -  4918 poll_s 11:25 ?        00:00:00 ntpd -u ntp:ntp -p /var/run/ntpd.pid -x
5 S root      36129      1  0  80   0 -  4812 poll_s 11:32 ?        00:00:00 ntpd
5 S root      93269      1  0  80   0 -  4812 poll_s  2015 ?        00:54:17 ntpd

--//可以发现现在多了一行,解决这个问题很简单,执行:
# kill -9 93269
# kill -9 36129

# ps -elf | grep  nt[p]
5 S ntp       24786      1  0  80   0 -  4918 poll_s 11:25 ?        00:00:00 ntpd -u ntp:ntp -p /var/run/ntpd.pid -x

# grep "Bad file descriptor" *.log  | tail -3
192.168.xxx.xxx_syslog.log:Dec 25 11:33:01 xxxxxxxxxx ntpd[36129]: sendto(192.168.yyy.yyy) (fd=-1): Bad file descriptor
192.168.xxx.xxx_syslog.log:Dec 25 11:33:03 xxxxxxxxxx ntpd[93269]: sendto(192.168.yyy.yyy) (fd=-1): Bad file descriptor
192.168.xxx.xxx_syslog.log:Dec 25 11:33:18 xxxxxxxxxx ntpd[36129]: sendto(192.168.yyy.yyy) (fd=-1): Bad file descriptor

--//最后的出现问题时间是11:33:18不再变化.说明问题解决.

# ntpq -p
     remote           refid      st t when poll reach   delay   offset  jitter
==============================================================================
*xx.xxxxxx.      5.79.108.34      3 u    4   16    7    0.323    0.152   0.181

--//做一个猜测可能对方想输入ntpq,结果不小心输入ntpd而导致的问题.也许这个人还是我^_^,说明做维护也要小心小心再小心.

来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/267265/viewspace-2670434/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
熟悉oracle相关技术,擅长sql优化,rman备份与恢复,熟悉linux shell编程。

注册时间:2008-01-03

  • 博文量
    4006
  • 访问量
    7969378