Bug 723051

Summary: subscription refresh hangs gui
Product: Red Hat Enterprise Linux 6 Reporter: J.C. Molet <jmolet>
Component: subscription-managerAssignee: Michael Stead <mstead>
Status: CLOSED DUPLICATE QA Contact: J.C. Molet <jmolet>
Severity: high Docs Contact:
Priority: unspecified    
Version: 6.2CC: mstead, spandey
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2011-07-19 19:27:08 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 682238    

Description J.C. Molet 2011-07-18 20:43:01 UTC
Description of problem:
When there are more than a few products on the system, subscription-manager-gui seems to hang in an infinite loop whenever it has to refresh its certificate staus/my-installed-software views.

Version-Release number of selected component (if applicable):
subscription-manager-firstboot-0.96.4-1.git.34.850053a.el6.x86_64
python-rhsm-0.96.7-1.git.3.f3ce5d1.el6.noarch
subscription-manager-gnome-0.96.4-1.git.34.850053a.el6.x86_64
subscription-manager-0.96.4-1.git.34.850053a.el6.x86_64

How reproducible:
most times

Steps to Reproduce:
There are a few ways to cause this, this is the most consistent:

1. start up subscription-manager-gui
2. register subscription manager (i used testuser1 with the admin org)
3. subscription-manager subscribe --auto on the cli

(this also happens when you autosubscribe it entirely in the gui)
  
Actual results:
There is an infinite loop of this in the rhsm.log:

2011-07-18 16:38:00,841 [DEBUG]  @cert_sorter.py:71 - Sorting product and entitlement cert status for: 2011-07-18 16:38:00.841410
2011-07-18 16:38:00,880 [DEBUG]  @cert_sorter.py:95 - Installed product IDs: ['100000000000060', '1000000041', '1144', '100000000000011', '100000000000010', '100000000000013', '100000000000012', '100000000000015', '10000000000043', '27060', '917571', '1', '37069', '37068', '37080', '37065', '37067', '37060', '37062', '100000000000006', '100000000000007', '100000000000004', '100000000000005', '100000000000002', '100000000000003', '100000000000000', '100000000000001', '100000000000020', '100000000000008', '100000000000009', '100000000000022', '38', '37', '42001', '42000', '37090', '37070']
2011-07-18 16:38:01,057 [DEBUG]  @cert_sorter.py:82 - valid entitled products: ['100000000000011', '100000000000010', '100000000000013', '100000000000012', '100000000000015', '27060', '37069', '37068', '37080', '37065', '37067', '37060', '100000000000006', '100000000000007', '100000000000002', '100000000000003', '100000000000000', '100000000000001', '100000000000020', '100000000000022', '100000000000009', '100000000000008', '37090', '37070']
2011-07-18 16:38:01,058 [DEBUG]  @cert_sorter.py:83 - expired entitled products: []
2011-07-18 16:38:07,015 [DEBUG]  @cert_sorter.py:71 - Sorting product and entitlement cert status for: 2011-07-18 16:38:07.015657
2011-07-18 16:38:07,056 [DEBUG]  @cert_sorter.py:95 - Installed product IDs: ['100000000000060', '1000000041', '1144', '100000000000011', '100000000000010', '100000000000013', '100000000000012', '100000000000015', '10000000000043', '27060', '917571', '1', '37069', '37068', '37080', '37065', '37067', '37060', '37062', '100000000000006', '100000000000007', '100000000000004', '100000000000005', '100000000000002', '100000000000003', '100000000000000', '100000000000001', '100000000000020', '100000000000008', '100000000000009', '100000000000022', '38', '37', '42001', '42000', '37090', '37070']
2011-07-18 16:38:07,246 [DEBUG]  @cert_sorter.py:82 - valid entitled products: ['100000000000011', '100000000000010', '100000000000013', '100000000000012', '100000000000015', '27060', '37069', '37068', '37080', '37065', '37067', '37060', '100000000000006', '100000000000007', '100000000000002', '100000000000003', '100000000000000', '100000000000001', '100000000000020', '100000000000022', '100000000000009', '100000000000008', '37090', '37070']
2011-07-18 16:38:07,247 [DEBUG]  @cert_sorter.py:83 - expired entitled products: []
2011-07-18 16:38:13,090 [DEBUG]  @cert_sorter.py:71 - Sorting product and entitlement cert status for: 2011-07-18 16:38:13.090339
2011-07-18 16:38:13,129 [DEBUG]  @cert_sorter.py:95 - Installed product IDs: ['100000000000060', '1000000041', '1144', '100000000000011', '100000000000010', '100000000000013', '100000000000012', '100000000000015', '10000000000043', '27060', '917571', '1', '37069', '37068', '37080', '37065', '37067', '37060', '37062', '100000000000006', '100000000000007', '100000000000004', '100000000000005', '100000000000002', '100000000000003', '100000000000000', '100000000000001', '100000000000020', '100000000000008', '100000000000009', '100000000000022', '38', '37', '42001', '42000', '37090', '37070']
2011-07-18 16:38:13,308 [DEBUG]  @cert_sorter.py:82 - valid entitled products: ['100000000000011', '100000000000010', '100000000000013', '100000000000012', '100000000000015', '27060', '37069', '37068', '37080', '37065', '37067', '37060', '100000000000006', '100000000000007', '100000000000002', '100000000000003', '100000000000000', '100000000000001', '100000000000020', '100000000000022', '100000000000009', '100000000000008', '37090', '37070']
2011-07-18 16:38:13,308 [DEBUG]  @cert_sorter.py:83 - expired entitled products: []

Expected results:
This shouldn't take any longer than it does when the my-installed-software tab is generated when the gui first starts up.

Additional info:
For an added bonus, killall subscription-manager-gui, then restart it.  Then click the unregister button.  It doesn't completely hang, but it does lock up for a good 5 minutes.

Comment 1 Michael Stead 2011-07-19 19:23:49 UTC
I've determined that we are not caught in an infinite loop, and it will end eventually.

The problem is that changes are being detected in entitlement cert directory multiple times per file (including any key files that exist as well). Looks like approx 3 change detections per file. So for me that was 90 changes detected.

For EACH change that is detected, ALL product certs are read from the disk and are sorted (CertSorter). Then the UI is updated with info from the sorter. This is very expensive, and i would guess that with a large number of products, on a slower machine, this would take quite some time.

Comment 2 Michael Stead 2011-07-19 19:27:08 UTC
Marking as duplicate of #720465

*** This bug has been marked as a duplicate of bug 720465 ***