Bug 679054

Summary: rhnsd fails to honour interval set in /etc/sysconfig/rhn/rhnsd
Product: Red Hat Enterprise Linux 6 Reporter: Adam Goodall <agoodall>
Component: rhnsdAssignee: Tomas Lestach <tlestach>
Status: CLOSED NOTABUG QA Contact: Šimon Lukašík <slukasik>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.0CC: jwest, mminar, mzazrivec, slukasik, tlestach
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: rhnsd-4.9.3-3.el6 Doc Type: Bug Fix
Doc Text:
Consequence: There's a random part added to the rhnsd interval every 12th run. The bug caused this random part to be always positive. Result: Random part to be computed correctly.
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-08-12 14:56:15 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:

Description Adam Goodall 2011-02-21 12:46:06 UTC
Description of problem:
If a different polling interval has been set in /etc/sysconfig/rhn/rhnsd it is ignored by the init script. The daemon starts but it will have ignored the INTERVAL setting and will have started up with the default INTERVAL of 240.

Version-Release number of selected component (if applicable):
rpm -qa rhnsd
rhnsd-4.9.3-2.el6.x86_64

How reproducible:
Always

Steps to Reproduce:
1. Edit /etc/sysconfig/rhn/rhnsd and set:
INTERVAL=10
2. service rhnsd restart
3. ps -ef | grep rhnsd

  
Actual results:
ps -ef | grep rhn
root     26033     1  0 12:28 ?        00:00:00 rhnsd


Expected results:
ps -ef | grep rhnsd
root     26238     1  0 12:32 ?        00:00:00 rhnsd --interval 10

Additional info:
This is a change of expected behaviour since RHEL5. The start section of the init script on rhel5 is:
start() {
    echo -n $"Starting Red Hat Network Daemon: "
    daemon rhnsd --interval $INTERVAL
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/rhnsd
}

Which clearly shows the interval being set. However on RHEL6 it is:
start() {
    echo -n $"Starting Red Hat Network Daemon: "
    daemon rhnsd
    RETVAL=$?
    echo
    [ $RETVAL -eq 0 ] && touch /var/lock/subsys/rhnsd
}

The man page for rhnsd on RHEL6 is unchanged from that on RHEL5 and still includes the same instructions so i would expect this to be functionally the same.

Comment 2 RHEL Program Management 2011-02-21 13:18:17 UTC
This request was evaluated by Red Hat Product Management for
inclusion in the current release of Red Hat Enterprise Linux.
Because the affected component is not scheduled to be updated
in the current release, Red Hat is unfortunately unable to
address this request at this time. Red Hat invites you to
ask your support representative to propose this request, if
appropriate and relevant, in the next release of Red Hat
Enterprise Linux. If you would like it considered as an
exception in the current release, please ask your support
representative.

Comment 3 Tomas Lestach 2011-07-22 12:51:12 UTC
Starting rhnsd as 'daemon rhnsd' on RHEL6 is intentional.

It was changed by commit: 2a815efda9bf2f62eece19b3cb2b6feea519df0a with comment: The rhnsd binary reads /etc/sysconfig/rhn/rhnsd, no need to pass the value in as argument.

I'll just verify rhn_check is run in the predefined interval.

Comment 4 Tomas Lestach 2011-07-29 11:35:04 UTC
I've found an issue, where the random part of the next rhn_check schedule time wasn't computed correctly. (Random part is added every 12th schedule.) The bug might cause some inaccuracies.

Fixed in upstream
spacewalk.git: 639ecfa0262fdae2fa53bc21dee7c0c0a0f470b4

Comment 5 Milan Zázrivec 2011-08-01 14:42:50 UTC
satellite.git CLIENT-RHEL-6: b921a08a46622f29b38df087ebcb4ac0336b59da

Comment 7 Tomas Lestach 2011-08-09 11:47:25 UTC
    Technical note added. If any revisions are required, please edit the "Technical Notes" field
    accordingly. All revisions will be proofread by the Engineering Content Services team.
    
    New Contents:
Consequence:
There's a random part added to the rhnsd interval every 12th run. The bug caused this random part to be always positive.
Result:
Random part to be computed correctly.

Comment 8 Šimon Lukašík 2011-08-11 07:57:45 UTC
Flipping back to Assigned.

I cannot reproduce a problem with current (old) package set. First of all,
the problem described in the first comment does not exists at all. Even
though rhnsd daemon does not get time interval from command-line arguments,
it (rhnsd) fetches the interval directly from sysconfig file. Therefore
I propose NOTABUG.

Secondly, the code changeset linked from this bugzilla,assumes that
time_t has a type of int. ANSI C does not include such assumption.
The base type of time_t may differ on different platforms.

Thirdly, the technical note contains the information, which is in
contradiction with my findings. I have run the (old) rhnsd daemon
for a while, and recorded all the times when the rhn_check was
executed. Let's see the concrete dates:

2011-08-09 14:49:55.193166
2011-08-09 15:49:55.687175
2011-08-09 16:49:55.530984
2011-08-09 17:49:56.217506
2011-08-09 18:49:56.104007
2011-08-09 19:49:55.861933
2011-08-09 20:49:55.811209
2011-08-09 21:49:55.472661
2011-08-09 22:49:56.079714
2011-08-09 23:49:55.467119
2011-08-10 00:49:55.324778
2011-08-10 01:49:55.731125
2011-08-10 02:36:47.089378
2011-08-10 03:36:46.799011
2011-08-10 04:36:46.214966
2011-08-10 05:36:46.766005
2011-08-10 06:36:46.199532
2011-08-10 07:36:46.715619
2011-08-10 08:36:47.061052
2011-08-10 09:36:46.615603
2011-08-10 10:36:46.631680
2011-08-10 11:36:46.669946
2011-08-10 12:36:47.136069
2011-08-10 13:36:46.899930
2011-08-10 14:21:12.427695
2011-08-10 15:21:12.237203
2011-08-10 16:21:12.853362
2011-08-10 17:21:12.834961
2011-08-10 18:21:12.456374
2011-08-10 19:21:12.803412
2011-08-10 20:21:12.317900
2011-08-10 21:21:12.784696
2011-08-10 22:21:12.376212
2011-08-10 23:21:12.685684
2011-08-11 00:21:13.132319
2011-08-11 01:21:12.405430
2011-08-11 01:56:44.844372
2011-08-11 02:56:44.224289
2011-08-11 03:56:44.631341
2011-08-11 04:56:45.071018
2011-08-11 05:56:44.562381
2011-08-11 06:56:44.784766
2011-08-11 07:56:44.182729
2011-08-11 08:56:44.490634

Every twelve hours, the random amount of time was added. But this random
amount was always negative in my test. 

With the current behaviour I can see the rhn_check was scheduled timely.

Tomas, If you are sure, that some underlying problem exists in the random
computation. Could you please describe reproducer more precisely?

And please note, that qa_ack+ was given for the scenario described in 
the comment 0.

Comment 9 Tomas Lestach 2011-08-12 14:56:15 UTC
Agreed with Simon, that the original request is NOTABUG.

I can provide a reproducer for the misbehavior I fixed, however I admit it's almost impossible for QA to verify the fix. If a random part isn't correctly added to a time value, QA cannot distinguish, if it's a random part or a tiny addition bug.
I created a new Bug 730350 for the issue and closing this one.