Bug 27361

Summary: kernel log messages only appear 3 times per minute.
Product: Base System Reporter: pkern <pkern>
Component: kernAssignee: Poul-Henning Kamp <phk>
Status: Closed FIXED    
Severity: Affects Only Me CC: pkern
Priority: Normal    
Version: 4.3-RELEASE   
Hardware: Any   
OS: Any   

Description pkern 2001-05-15 22:20:00 UTC
	syslogd gets kernel log messages only once every 30 seconds or
	at the top of the minute, whichever comes first.  It seems
	logtimeout() is only called once after the kernel log is opened
	and then never again after that.  So I guess syslogd only gets
	kernel log messages by virtue of syncer(4)'s flushes ...?

Fix: 

--- /sys/kern/subr_log.c	2001/05/15 16:20:19	1.1
	+++ /sys/kern/subr_log.c	2001/05/15 18:55:15
	@@ -116,8 +116,8 @@
	 logclose(dev_t dev, int flag, int mode, struct proc *p)
	 {
	 
	-	callout_stop(&logsoftc.sc_callout);
		log_open = 0;
	+	callout_stop(&logsoftc.sc_callout);
		logsoftc.sc_state = 0;
		funsetown(logsoftc.sc_sigio);
		return (0);
	@@ -189,11 +189,14 @@
	 logtimeout(void *arg)
	 {
	 
	-	if (msgbuftrigger == 0)
	-		return;
	-	msgbuftrigger = 0;
		if (!log_open)
			return;
	+	if (msgbuftrigger == 0) {
	+		callout_reset(&logsoftc.sc_callout,
	+		    hz / log_wakeups_per_second, logtimeout, NULL);
	+		return;
	+	}
	+	msgbuftrigger = 0;
		selwakeup(&logsoftc.sc_selp);
		if ((logsoftc.sc_state & LOG_ASYNC) && logsoftc.sc_sigio != NULL)
			pgsigio(logsoftc.sc_sigio, SIGIO, 0);
How-To-Repeat: 
	any activity which is guaranteed to generate kernel log
	messages more frequently than once every 30 seconds.

	eg.
	on a kernel configured with IPFIREWALL and IPFIREWALL_VERBOSE ...
	  # ipfw add 10 count log logamount 199990 ip from any to any
	  # ping -c 100 127.0.0.1
	... and look in /var/log/security.  the timestamps will tend to
	clump together at regular 30-sec intervals or at :00 seconds.
Comment 1 dwmalone freebsd_committer freebsd_triage 2001-05-16 09:46:13 UTC
Responsible Changed
From-To: freebsd-bugs->phk

msgbuftrigger stuff was tweaked by phk last.
Comment 2 Poul-Henning Kamp freebsd_committer freebsd_triage 2001-05-23 20:02:54 UTC
State Changed
From-To: open->closed

Committed, thanks!