Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 27643 - rwhod fails with > 42(?) current terminal sessions
rwhod fails with > 42(?) current terminal sessions
Product: Fedora
Classification: Fedora
Component: rwho (Show other bugs)
i386 Linux
medium Severity medium
: ---
: ---
Assigned To: Phil Knirsch
David Lawrence
Depends On:
  Show dependency treegraph
Reported: 2001-02-14 12:59 EST by Tony Scholes
Modified: 2015-03-04 20:08 EST (History)
1 user (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2004-10-22 08:32:03 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Tony Scholes 2001-02-14 12:59:25 EST
From Bugzilla Helper:
User-Agent: Mozilla/4.76 [en] (X11; U; Linux 2.2.16-3 i686)

From /usr/include/protocols/rwhod.h a whod struct contains an array (wd_we)
of 1024/ (sizeof (struct whoent)) = 42 (I think) whoent structs, but does
not seem to check when populating this array, and scribbles over other
variables in the heap including the socket descriptor.

When this happens rwhod loops while trying to recv from the socket and logs
large numbers of messages to syslogd (visble in /var/log/messages), both
rwhod and syslogd consume large amounts of CPU time.

Reproducible: Always
Steps to Reproduce:
1. Make sure rwhod is running (e.g. use linuxconf) check that stats are
being reported correctly by using ruptime, check that no logs are being
produced (examine /var/log/messages), check cpu utlisation with top.
2. Get > 42 active terminal sessions running (can be simulated using a
script an rlogin for example)
3. Voila! Check CPU utilisation with top, look at /var/log/messages, after
a short while ruptime will display that the system is down.

I've kludged a solution (on a live database server with ~ 100 current
users) by getting the Source RPM for rwho 0.17 and hacking the source to
declare the size of the wd_we array to be 4096/(sizeof (struct whoent)) in
protocols/rwhod.h ...

There is also a line in rwhod.c that needs changing to match 

BUT, this is abviously a horrid solution, and I'm not sure it's a good one,
either the code should be checked to make sure it never runs of the end of
the array, or it should dynamically allocate memory for these whoent's as
required, and I'm not sure how to go about getting advise on which is best
or how to provide patching info etc.
Comment 1 Preston Brown 2001-03-05 16:23:49 EST

how would you like to go about addressing this bug?  Increase the static buffer
size, or are you going to recode this stuff to be dynamic any time in the near
BTW, I checked out OpenBSDs latest rwhod; appears to have the same issue, but it
seems to have several more features added in the last few years as well...
Comment 2 Phil Knirsch 2004-08-31 10:17:17 EDT
Just checked, bug is still in Fedora Core 2.

Read ya, Phil
Comment 3 Phil Knirsch 2004-10-22 08:32:03 EDT
Fixed it buy patching to allow now 1024 users per host.

That should be sufficent for most needs.

Read ya, Phil

Note You need to log in before you can comment on or make changes to this bug.