Bug 210020 - newsyslog sleeps for 10 seconds even when -s & -R specified
Summary: newsyslog sleeps for 10 seconds even when -s & -R specified
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 10.0-RELEASE
Hardware: Any Any
: --- Affects Some People
Assignee: Eric van Gyzen
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-06-04 13:33 UTC by David Bright
Modified: 2016-06-15 14:12 UTC (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description David Bright freebsd_committer freebsd_triage 2016-06-04 13:33:19 UTC

    
Comment 1 David Bright freebsd_committer freebsd_triage 2016-06-04 14:01:49 UTC
From the man page description of the -R flag:

	      	      	      	      	             When a daemon does exe-
	     cute newsyslog with the -R	option,	it should make sure all	of the
	     log files are closed before calling newsyslog, and	then it	should
	     re-open the files after newsyslog returns.	 Usually the calling
	     process will also want to specify the -s option, so newsyslog
	     will not send a signal to the very	process	which called it	to
	     force the rotate.	Skipping the signal step will also mean	that
	     newsyslog will return faster, since newsyslog normally waits a
	     few seconds after any signal that is sent.

After going through the signal work list, during which do_sigwork() is called and essentially does nothing because -s and -R were specified on the command line, newsyslog will sleep for 10 seconds as the (verbose) code says: "Pause 10 seconds to allow daemon(s) to close log file(s)".

However, the man page verbiage for -R (and -s) seems quite clear that this sleep() is unnecessary because the daemon was expected to have already closed the log file before calling newsyslog. I submit that the sleep should be eliminated in at least the case where -R and -s have been specified and possibly also in the case where only -s was specified (if there were no signal sent, how is the daemon supposed to know to close (and reopen) the log file?).
Comment 2 David Bright freebsd_committer freebsd_triage 2016-06-04 14:09:15 UTC
Patch available at: https://reviews.freebsd.org/D6727
Comment 3 commit-hook freebsd_committer freebsd_triage 2016-06-06 22:54:51 UTC
A commit references this bug:

Author: vangyzen
Date: Mon Jun  6 22:54:08 UTC 2016
New revision: 301532
URL: https://svnweb.freebsd.org/changeset/base/301532

Log:
  newsyslog: Eliminate unnecessary sleep(10) when -R and -s are specified

  After going through the signal work list, during which do_sigwork()
  is called and essentially does nothing because -s and -R were
  specified on the command line, newsyslog will sleep for 10 seconds
  as the (verbose) code says: "Pause 10 seconds to allow daemon(s)
  to close log file(s)".

  However, the man page verbiage for -R (and -s) seems quite clear
  that this sleep() is unnecessary because the daemon was expected
  to have already closed the log file before calling newsyslog.

  PR:		210020
  Submitted by:	David A. Bright <david_a_bright@dell.com>
  MFC after:	1 week
  Sponsored by:	Dell Inc.
  Differential Revision:	https://reviews.freebsd.org/D6727

Changes:
  head/usr.sbin/newsyslog/newsyslog.c
Comment 4 Mark Linimon freebsd_committer freebsd_triage 2016-06-13 15:39:39 UTC
Already committed.
Comment 5 commit-hook freebsd_committer freebsd_triage 2016-06-15 14:12:28 UTC
A commit references this bug:

Author: vangyzen
Date: Wed Jun 15 14:11:49 UTC 2016
New revision: 301926
URL: https://svnweb.freebsd.org/changeset/base/301926

Log:
  MFC r301532

  newsyslog: Eliminate unnecessary sleep(10) when -R and -s are specified

  After going through the signal work list, during which do_sigwork()
  is called and essentially does nothing because -s and -R were
  specified on the command line, newsyslog will sleep for 10 seconds
  as the (verbose) code says: "Pause 10 seconds to allow daemon(s)
  to close log file(s)".

  However, the man page verbiage for -R (and -s) seems quite clear
  that this sleep() is unnecessary because the daemon was expected
  to have already closed the log file before calling newsyslog.

  PR:		210020
  Submitted by:	David A. Bright <david_a_bright@dell.com>
  Sponsored by:	Dell Inc.

Changes:
_U  stable/10/
  stable/10/usr.sbin/newsyslog/newsyslog.c
Comment 6 commit-hook freebsd_committer freebsd_triage 2016-06-15 14:12:30 UTC
A commit references this bug:

Author: vangyzen
Date: Wed Jun 15 14:12:22 UTC 2016
New revision: 301927
URL: https://svnweb.freebsd.org/changeset/base/301927

Log:
  MFC r301532

  newsyslog: Eliminate unnecessary sleep(10) when -R and -s are specified

  After going through the signal work list, during which do_sigwork()
  is called and essentially does nothing because -s and -R were
  specified on the command line, newsyslog will sleep for 10 seconds
  as the (verbose) code says: "Pause 10 seconds to allow daemon(s)
  to close log file(s)".

  However, the man page verbiage for -R (and -s) seems quite clear
  that this sleep() is unnecessary because the daemon was expected
  to have already closed the log file before calling newsyslog.

  PR:		210020
  Submitted by:	David A. Bright <david_a_bright@dell.com>
  Sponsored by:	Dell Inc.

Changes:
_U  stable/9/usr.sbin/newsyslog/
  stable/9/usr.sbin/newsyslog/newsyslog.c