Bug 1035440 - subscription-manager yum plugin makes yum refresh all RHSM repos. on every command.
Summary: subscription-manager yum plugin makes yum refresh all RHSM repos. on every co...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Red Hat Enterprise Linux 5
Classification: Red Hat
Component: subscription-manager
Version: 5.11
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: rc
: ---
Assignee: Bryan Kearney
QA Contact: John Sefler
URL:
Whiteboard:
Depends On:
Blocks: rhsm-rhel511
TreeView+ depends on / blocked
 
Reported: 2013-11-27 19:18 UTC by James Antill
Modified: 2014-09-16 00:22 UTC (History)
2 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
: 1104731 (view as bug list)
Environment:
Last Closed: 2014-09-16 00:22:00 UTC


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2014:1225 normal SHIPPED_LIVE subscription-manager bug fix and enhancement update 2014-09-16 04:15:23 UTC

Description James Antill 2013-11-27 19:18:44 UTC
Description of problem:
 subscription-manager plugin regenerates the redhat.repo file every run, even if nothing has changed. yum sees that the repofile is newer than the cached download of the metadata, and so does the network checks (Eg. baseurl/etc. could have changed).
 This is a huge performance hit (as local operations have to connect to the network).


Version-Release number of selected component (if applicable):

subscription-manager-1.8.22-1.el6_4


Steps to Reproduce:
Run:

time yum list yum
time yum list yum --disableplugin=subscription-manager 

Fix:

 The simplest thing to do is write to redhat.repo.tmp, and then if redhat.repo is the same size compare the bytes and unlink or rename based on if they are the same.

Comment 2 RHEL Product and Program Management 2013-11-30 23:06:37 UTC
This request was not resolved in time for the current release.
Red Hat invites you to ask your support representative to
propose this request, if still desired, for consideration in
the next release of Red Hat Enterprise Linux.

Comment 4 RHEL Product and Program Management 2014-05-27 17:48:01 UTC
This request was evaluated by Red Hat Product Management for inclusion
in a Red Hat Enterprise Linux release.  Product Management has
requested further review of this request by Red Hat Engineering, for
potential inclusion in a Red Hat Enterprise Linux release for currently
deployed products.  This request is not yet committed for inclusion in
a release.

Comment 5 Carter Kozak 2014-05-28 15:06:42 UTC
commit 5ea458dd3fed6414758ff9a8c785ba33b81f8918
Author: ckozak <ckozak@redhat.com>
Date:   Wed May 21 13:51:58 2014 -0400

    1035440: Don't rewrite redhat.repo unless it has changed

Comment 7 John Sefler 2014-06-03 14:21:12 UTC
Demonstrating this bug on version...
[root@jsefler-5 ~]# subscription-manager version
server type: This system is currently not registered.
subscription management server: 0.9.10.2-1
subscription-manager: 1.11.3-2.el5
python-rhsm: 1.11.3-2.el5


After registering and attaching a subscription...

[root@jsefler-5 ~]# cat /etc/yum.repos.d/redhat.repo > /tmp/redhat.repo.A
[root@jsefler-5 ~]# stat -c %y /etc/yum.repos.d/redhat.repo 
2014-06-03 10:01:13.000000000 -0400
[root@jsefler-5 ~]# yum -q repolist --enableplugin subscription-manager
This system is not registered with RHN Classic or RHN Satellite.
You can use rhn_register to register.
RHN Satellite or RHN Classic support will be disabled.
[root@jsefler-5 ~]# stat -c %y /etc/yum.repos.d/redhat.repo 
2014-06-03 10:02:44.000000000 -0400
[root@jsefler-5 ~]# yum -q repolist --enableplugin subscription-manager
This system is not registered with RHN Classic or RHN Satellite.
You can use rhn_register to register.
RHN Satellite or RHN Classic support will be disabled.
[root@jsefler-5 ~]# stat -c %y /etc/yum.repos.d/redhat.repo 
2014-06-03 10:03:29.000000000 -0400
[root@jsefler-5 ~]# yum -q repolist --enableplugin subscription-manager
This system is not registered with RHN Classic or RHN Satellite.
You can use rhn_register to register.
RHN Satellite or RHN Classic support will be disabled.
[root@jsefler-5 ~]# stat -c %y /etc/yum.repos.d/redhat.repo 
2014-06-03 10:03:47.000000000 -0400
[root@jsefler-5 ~]# stat -c %y /etc/yum.repos.d/redhat.repo 
2014-06-03 10:03:47.000000000 -0400
[root@jsefler-5 ~]# cat /etc/yum.repos.d/redhat.repo > /tmp/redhat.repo.B
[root@jsefler-5 ~]# diff /tmp/redhat.repo.A /tmp/redhat.repo.B
[root@jsefler-5 ~]# 

In the above test, you will notice that the time of last modification to the redhat.repo file changes every time the yum subscription-manager plugin is triggered by calling yum repolist.  Yet the contents of the redhat.repo file  show no difference before and after all of the modification time stamps.

Clearly we are re-writing the redhat.repo file unnecessarily.

Comment 8 John Sefler 2014-06-03 15:49:17 UTC
Verifying fixed subscription-manager version...
[root@jsefler-5 ~]# subscription-manager version
server type: This system is currently not registered.
subscription management server: 0.9.12-1
subscription-manager: 1.11.3-5.el5
python-rhsm: 1.11.3-3.el5


After registering and attaching a subscription...

[root@jsefler-5 ~]# cat /etc/yum.repos.d/redhat.repo > /tmp/redhat.repo.A
[root@jsefler-5 ~]# stat -c %y /etc/yum.repos.d/redhat.repo
2014-06-03 11:36:30.000000000 -0400
[root@jsefler-5 ~]# yum -q repolist --enableplugin subscription-manager
This system is not registered with RHN Classic or RHN Satellite.
You can use rhn_register to register.
RHN Satellite or RHN Classic support will be disabled.
[root@jsefler-5 ~]# stat -c %y /etc/yum.repos.d/redhat.repo
2014-06-03 11:36:30.000000000 -0400
[root@jsefler-5 ~]# yum -q repolist --enableplugin subscription-manager
This system is not registered with RHN Classic or RHN Satellite.
You can use rhn_register to register.
RHN Satellite or RHN Classic support will be disabled.
[root@jsefler-5 ~]# stat -c %y /etc/yum.repos.d/redhat.repo
2014-06-03 11:36:30.000000000 -0400
[root@jsefler-5 ~]# yum -q clean all --enableplugin subscription-manager
[root@jsefler-5 ~]# stat -c %y /etc/yum.repos.d/redhat.repo
2014-06-03 11:36:30.000000000 -0400
[root@jsefler-5 ~]# yum list --enableplugin subscription-manager > /dev/null
This system is not registered with RHN Classic or RHN Satellite.
You can use rhn_register to register.
RHN Satellite or RHN Classic support will be disabled.
[root@jsefler-5 ~]# stat -c %y /etc/yum.repos.d/redhat.repo
2014-06-03 11:36:30.000000000 -0400
[root@jsefler-5 ~]# cat /etc/yum.repos.d/redhat.repo > /tmp/redhat.repo.B
[root@jsefler-5 ~]# diff /tmp/redhat.repo.A /tmp/redhat.repo.B
[root@jsefler-5 ~]# 

In the above verification, you will notice that the time of last modification to the redhat.repo file remains the same every time the yum subscription-manager plugin is triggered by calling yum.  This is because the redhat.repo file is no longer being re-written unnecessarily during execution of the yum subscription-manager plugin.

Moving to VERIFIED

Comment 11 errata-xmlrpc 2014-09-16 00:22:00 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, and where to find the updated
files, follow the link below.

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

http://rhn.redhat.com/errata/RHBA-2014-1225.html


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