RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1827708 - /etc/cron.daily/rhsmd fails to recognize rhsmd.processtimeout configuration
Summary: /etc/cron.daily/rhsmd fails to recognize rhsmd.processtimeout configuration
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: subscription-manager
Version: 8.2
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: rc
: 8.3
Assignee: candlepin-bugs
QA Contact: Red Hat subscription-manager QE Team
URL:
Whiteboard:
Depends On:
Blocks: 1827711 1828657
TreeView+ depends on / blocked
 
Reported: 2020-04-24 15:24 UTC by John Sefler
Modified: 2024-06-13 22:35 UTC (History)
5 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
: 1827711 1828657 (view as bug list)
Environment:
Last Closed: 2020-11-04 01:39:09 UTC
Type: Bug
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2020:4460 0 None None None 2020-11-04 01:39:30 UTC

Description John Sefler 2020-04-24 15:24:31 UTC
Description of problem:
In the scenario that a customer upgrades subscription-manager from an older version, it is possible that the /etc/rhsm/rhsm.conf configuration file will be be carried forward from their old installation and be absent of the new [rhsmd] processTimeout configuration introduced by bug 1643189.   When this happens, a user may choose to change the default value [300 seconds] of this config by calling...

subscription-manager config --rhsmd.processtimeout=200

which will introduce a new configuration in /etc/rhsm/rhsm.conf all in lowercase characters.  The problem is that the script /etc/cron.daily/rhsmd has an error that will not recognize the lowercase character configuration.  The fix is to  add an "--ignore-case" option to the first line of code in /etc/cron.daily/rhsmd
Change this line of code...

> config=$(grep -E "^processTimeout" /etc/rhsm/rhsm.conf | grep -Po "[0-9]+")

to this...

> config=$(grep -iE "^processTimeout" /etc/rhsm/rhsm.conf | grep -Po "[0-9]+")


Version-Release number of selected component (if applicable):
[root@kvm-01-guest06 ~]# rpm -q --whatprovides /etc/cron.daily/rhsmd 
subscription-manager-1.26.16-1.el8.x86_64


How reproducible:


Steps to Reproduce:
Make sure that /etc/rhsm/rhsm.conf is absent of the processTimeout configuration....
[root@kvm-01-guest06 ~]# grep --ignore-case "processTimeout" /etc/rhsm/rhsm.conf
[root@kvm-01-guest06 ~]# 

Then here is the test that shows /etc/rhsm/rhsm.conf fails to read a properly configured rhsmd.processtimeout...
[root@kvm-01-guest06 ~]# subscription-manager config | grep --ignore-case "processTimeout"
   processtimeout = [300]
[root@kvm-01-guest06 ~]# 
[root@kvm-01-guest06 ~]# subscription-manager config --rhsmd.processtimeout=120
[root@kvm-01-guest06 ~]# 
[root@kvm-01-guest06 ~]# subscription-manager config | grep --ignore-case "processTimeout"
   processtimeout = 120
[root@kvm-01-guest06 ~]# 
[root@kvm-01-guest06 ~]# time /etc/cron.daily/rhsmd

real	5m0.065s
user	0m0.455s
sys	0m0.126s



Actual results:
 the /etc/cron.daily/rhsmd took 5minutes (equivaluent to the 300sec default) to timeout

Expected results:
 the /etc/cron.daily/rhsmd should have taken 2minutes (equivaluent to the configured 120sec) to timeout


Additional info:

Here is the current implementation of /etc/cron.daily/rhsmd

[root@kvm-01-guest06 ~]# cat /etc/cron.daily/rhsmd
#!/bin/sh
# nightly run of rhsmd to log entitlement expiration/validity errors to syslog
# this is a cron job because it doesn't need to 'phone home'. should that
# change, look into calling the dbus interface from rhsmcertd instead.
config=$(grep -E "^processTimeout" /etc/rhsm/rhsm.conf | grep -Po "[0-9]+")
if [ -n "$config" ]; then
  rhsmd_timeout=$config
else
  rhsmd_timeout=300
fi

/usr/libexec/rhsmd -s &
sleep $rhsmd_timeout;

ps_check=$(pgrep -f '/usr/libexec/rhsmd')
if [ -n "$ps_check" ]; then
  pkill -f '/usr/libexec/rhsmd' >/dev/null 2>&1
  logger -t rhsmd -p user.warn "rhsmd process exceeded runtime and was killed." >/dev/null 2>&1
fi
[root@kvm-01-guest06 ~]#

Comment 10 John Sefler 2020-06-25 21:48:18 UTC
Technically speaking, the significance of this bug on rhel8.3 has been obsoleted by the work done on Bug 1780028 (which was really implemented by Bug 1775714).  Therefore, to verify this bug, I will attempt to verify that /etc/cron.daily/rhsmd is no longer provided by subscription-manager and that all instances of rhsmd.processtimeout have been removed....

Testing Version....
[root@kvm-06-guest22 ~]# rpm -qa | grep subscription-manager | sort
dnf-plugin-subscription-manager-1.27.8-1.el8.x86_64
python3-subscription-manager-rhsm-1.27.8-1.el8.x86_64
subscription-manager-1.27.8-1.el8.x86_64
subscription-manager-cockpit-1.27.8-1.el8.noarch
subscription-manager-debuginfo-1.27.8-1.el8.x86_64
subscription-manager-debugsource-1.27.8-1.el8.x86_64
subscription-manager-initial-setup-addon-1.27.8-1.el8.x86_64
subscription-manager-migration-1.27.8-1.el8.x86_64
subscription-manager-migration-data-2.0.51-1.noarch
subscription-manager-plugin-ostree-1.27.8-1.el8.x86_64
subscription-manager-rhsm-certificates-1.27.8-1.el8.x86_64
[root@kvm-06-guest22 ~]# 
[root@kvm-06-guest22 ~]# rpm -q subscription-manager --changelog | egrep "1827708|1780028|1775714"
- 1827708: Make rhsmd cron read 'processTimeout' case-
- 1775714: Do not install rhsmd and rhsm-icon on rhel8; ENT-1959
[root@kvm-06-guest22 ~]# 

_______________________________________________________
[root@kvm-06-guest22 ~]# ls /etc/cron.daily/rhsmd
ls: cannot access '/etc/cron.daily/rhsmd': No such file or directory
[root@kvm-06-guest22 ~]# 
[root@kvm-06-guest22 ~]# rpm -ql subscription-manager | grep cron
[root@kvm-06-guest22 ~]# 

VERIFIED: "/etc/cron.daily/rhsmd" is no longer installed and is not provided by subscription-manager-1.27.8-1

_______________________________________________________
[root@kvm-06-guest22 ~]# grep -B1 -i processTimeout /etc/rhsm/rhsm.conf 
# The time in seconds we will allow the rhsmd cron job to run before terminating the process.
processTimeout = 300
[root@kvm-06-guest22 ~]# 

FAILED: There should be no more processTimeout configuration in rhsm.conf since "/etc/cron.daily/rhsmd" has been obsoleted.

_______________________________________________________
[root@kvm-06-guest22 ~]# man -P cat rhsm.conf | grep -A1 -i processTimeout
       processTimeout
           The time in seconds we will allow the rhsmd cron job to run before terminating the process.
[root@kvm-06-guest22 ~]# 

FAILED: There should be no more processTimeout discussion in the man page for rhsm.conf

_______________________________________________________
[root@kvm-06-guest22 ~]# subscription-manager config --help | grep -i processTimeout
  --rhsmd.processtimeout=RHSMD.PROCESSTIMEOUT
                        Section: rhsmd, Name: processtimeout
[root@kvm-06-guest22 ~]# 

FAILED: There should be no need to be able to use the config mudule to set processTimeout



Moving back to NEW/FailedQA to finish the job of obsoleting processTimeout

Comment 11 John Sefler 2020-06-26 12:07:21 UTC
I changed my mind on how to close out this bugzilla....
This bug was opened specifically to apply a fix to /etc/cron.daily/rhsmd and the fix was applied, but was irrelevant due to the removal of the file by bug 1780028 (which was really implemented by bug 1775714).  Therefore I will close out this bug as VERIFIED and move the FAILED QA issues from comment 10 to bug 1780028 where they are more relevant.

Comment 14 errata-xmlrpc 2020-11-04 01:39:09 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory (subscription-manager bug fix and enhancement update), and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:4460


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