CURRENT [r308040] watchdogd regression

From: Alex Deiter <alex.deiter_at_gmail.com>
Date: Wed, 9 Nov 2016 19:42:28 +0300
Hello,

Just found that rev r308040 had introduced regression bug for watchdogd:

if watchdogd start by default (without parameters), it use 100% CPU:

  PID USERNAME      THR PRI NICE   SIZE    RES STATE   C   TIME    WCPU COMMAND
14954 root            1 -52   r0  7524K  3496K CPU2    2   0:44 100.36% watchdogd

# truss -afd -p 14954
...
14954: 1.640554819 ioctl(4,WDIOCPATPAT,0xffffea60) = 0 (0x0)
14954: 1.640608166 stat("/etc",{ mode=drwxr-xr-x ,inode=21,size=109,blksize=7168 }) = 0 (0x0)
14954: 1.642456843 ioctl(4,WDIOCPATPAT,0xffffea60) = 0 (0x0)
14954: 1.642511284 stat("/etc",{ mode=drwxr-xr-x ,inode=21,size=109,blksize=7168 }) = 0 (0x0)
14954: 1.643971019 ioctl(4,WDIOCPATPAT,0xffffea60) = 0 (0x0)
14954: 1.644008391 stat("/etc",{ mode=drwxr-xr-x ,inode=21,size=109,blksize=7168 }) = 0 (0x0)
14954: 1.645305166 ioctl(4,WDIOCPATPAT,0xffffea60) = 0 (0x0)
14954: 1.645329823 stat("/etc",{ mode=drwxr-xr-x ,inode=21,size=109,blksize=7168 }) = 0 (0x0)
14954: 1.646621223 ioctl(4,WDIOCPATPAT,0xffffea60) = 0 (0x0)
14954: 1.646645072 stat("/etc",{ mode=drwxr-xr-x ,inode=21,size=109,blksize=7168 }) = 0 (0x0)
14954: 1.647935561 ioctl(4,WDIOCPATPAT,0xffffea60) = 0 (0x0)


Root cause - uninitialized variable timeout_sec

https://svnweb.freebsd.org/base/head/usr.sbin/watchdogd/watchdogd.c?revision=308040&view=markup#l82

static u_int timeout_sec;

and changes, introduced in r308040:

774	 	         if (nap > timeout_sec / 2)
775	 	                 nap = timeout_sec / 2;

Workaround: specify the desired timeout period in seconds: 

watchdogd_enable="YES"
watchdogd_flags="-t 128”

Thank you!

--
Alex Deiter
alex.deiter_at_gmail.com
Received on Wed Nov 09 2016 - 15:42:33 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:41:08 UTC