** Description changed:

  I'm using Ubuntu trusty, specifically Ubuntu 14.04.3 LTS
  I have package xinetd version 1:2.3.15-3ubuntu1.
  
  I think this problem also reproduces in latest xinetd on xenial.
  
  Repro steps:
  1. Run /etc/init.d/xinetd status
  
  EXPECTED BEHAVIOR
  The service-status script for xinetd outputs some information about whether 
or not the service is currently healthy.
  
  ACTUAL BEHAVIOR
- The service-status script for xinetd outputs all the information it has ever 
gathered since the OS was first installed about the internal state of xinetd, 
replaying the output of each internal state dump sequentially. 
+ The service-status script for xinetd outputs all the information it has ever 
gathered since the OS was first installed about the internal state of xinetd, 
replaying the output of each internal state dump sequentially.
  
  If you do this a lot, say once a minute for a few months, each call to
  "/etc/init.d/xinetd status" may end up printing hundreds of megabytes of
  data from a file.
  
- What's going on on the hood:
- (1) First, the service-status script (/etc/init.d/xinetd) checks whether the 
xinetd process is running; if no, it returns an error code. Assuming the 
process is running, the status script 
+ What's going on under the hood:
+ (1) First, the service-status script (/etc/init.d/xinetd) checks whether the 
xinetd process is running; if no, it returns an error code. Assuming the 
process is running, the status script
  sends a SIGUSR1 signal to the running xinetd process, which per the manual 
page "causes an internal state dump (the default dump file is 
/var/run/xinetd.dump; to change the filename, edit  config.h and recompile)."
  
  (2) The manual page isn't explicit about this, but what happens is that
  xinetd *appends* a bunch of state information, about 90 lines of text
  comprising 2 kilobytes, to the file /var/run/xinetd.dump (this file
  location is compiled in).
  
  (3) Next, the service-status script reads that file ("cat
  /var/run/xinetd.dump").
  
  This prints the whole file out to terminal or the calling process. If
  you have run /etc/init.d/xinetd status, say, nine times since you
  installed your OS, the output of your tenth "/etc/init.d/xinetd status"
  will be about 20 kilobytes / about 900 lines, containing each state dump
  that has ever been produced, one at a time.
  
  SURPRISING SIDE EFFECTS
  If you invoke this script via "/usr/sbin/service --status-all", that wrapper 
script will read all of /var/run/xinetd.dump into a bash variable and check 
whether it is nonempty as part of describing whether all installed 
init-script-managed services on the system are running.
  
  If you are running automated monitoring which calls "service --status-
  all" once a minute in order to measure which services are installed &
  running over time, you will notice that performance of your system
  gradually degrades, with huge amounts of I/O being spent repeatedly
  reading the entire file of all xinetd dumps for all time into a bash
  variable.
  
  PROPOSED FIX
  It seems like maybe, any of the following should happen
-  (a) the xinetd package configures logrotate to periodically rotate old 
/var/run/xinetd.dump files
-  (b) the xinetd service changes its response to SIGUSR1 to *write* state to 
file /var/run/xinetd.dump instead of *appending* state to it (some significant 
side effects! maybe users want that history!)
-  (c) the status script /etc/init.d/xinetd changes its implementation of 
"report service health" to check health in some way other than dumping internal 
xinetd state then printing the history of all past dumps.
+  (a) the xinetd package configures logrotate to periodically rotate old 
/var/run/xinetd.dump files
+  (b) the xinetd service changes its response to SIGUSR1 to *write* state to 
file /var/run/xinetd.dump instead of *appending* state to it (some significant 
side effects! maybe users want that history!)
+  (c) the status script /etc/init.d/xinetd changes its implementation of 
"report service health" to check health in some way other than dumping internal 
xinetd state then printing the history of all past dumps.

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1678191

Title:
  xinetd service status script appends to /var/run/xinetd.dump with no
  rotation mechanism

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/xinetd/+bug/1678191/+subscriptions

-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to