Bug 1292877 - Runtime Error null is encountered after a secondary auto-attach while consuming a CDK entitlement plus a Standard entitlement
Summary: Runtime Error null is encountered after a secondary auto-attach while consumi...
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Candlepin
Classification: Community
Component: candlepin
Version: 1.2
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: ---
Assignee: Michael Stead
QA Contact: Katello QA List
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-12-18 15:55 UTC by John Sefler
Modified: 2016-07-22 14:52 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2016-07-22 14:52:20 UTC
Embargoed:


Attachments (Terms of Use)

Description John Sefler 2015-12-18 15:55:50 UTC
Description of problem:
After auto-attaching a CDK entitlement followed by a manual attach of a Standard subscription followed by another auto-attach, the following traceback is being thrown...

2015-12-18 10:31:52,722 [DEBUG] subscription-manager:26265 @connection.py:530 - Making request: POST /candlepin/consumers/9b4e72f6-5d88-44b3-b775-c6070d8c9ec1/entitlements
2015-12-18 10:31:52,791 [DEBUG] subscription-manager:26265 @cache.py:110 - Wrote cache: /var/lib/rhsm/cache/entitlement_status.json
2015-12-18 10:31:53,211 [DEBUG] subscription-manager:26265 @connection.py:562 - Response: status=500, requestUuid=4b70ff8c-d351-48ee-a246-cb478eadcdc6
2015-12-18 10:31:53,213 [WARNING] subscription-manager:26265 @managercli.py:201 - Error during auto-attach.
2015-12-18 10:31:53,215 [ERROR] subscription-manager:26265 @managercli.py:202 - Runtime Error null at org.hibernate.engine.internal.StatefulPersistenceContext.getLoadedCollectionOwnerOrNull:859
Traceback (most recent call last):
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 197, in autosubscribe
    ents = cp.bind(consumer_uuid)  # new style
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 1148, in bind
    return self.conn.request_post(method)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 657, in request_post
    return self._request("POST", method, params)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 571, in _request
    self.validateResponse(result, request_type, handler)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 621, in validateResponse
    raise RestlibException(response['status'], error_msg, response.get('headers'))
RestlibException: Runtime Error null at org.hibernate.engine.internal.StatefulPersistenceContext.getLoadedCollectionOwnerOrNull:859



Version-Release number of selected component (if applicable):
[root@jsefler-f22-candlepin candlepin]# git show | head -1
commit 5f8f6ccde63cf55942b3af97cac778a0eee08728   <==== my standalone master candlepin is here
[root@jsefler-6 ~]# subscription-manager version
server type: Red Hat Subscription Management
subscription management server: 2.0.10-1
subscription management rules: 5.19
subscription-manager: 1.16.6-1.git.14.bc10efd.el6
python-rhsm: 1.16.4-1.git.5.3d9a48c.el6


How reproducible:


Steps to Reproduce:
[root@jsefler-6 ~]# subscription-manager facts --list | grep dev_sku
dev_sku: dev-sku-product
[root@jsefler-6 ~]# 
[root@jsefler-6 ~]# 
[root@jsefler-6 ~]# subscription-manager register --serverurl=jsefler-f22-candlepin.usersys.redhat.com:8443/candlepin --username testuser1 --org admin --autosubscribe
Registering to: jsefler-f22-candlepin.usersys.redhat.com:8443/candlepin
Password: 
The system has been registered with ID: 0109ddda-dd4f-4802-b01d-6ab5201715ac 

Installed Product Current Status:
Product Name: Awesome OS for ia64 Bits
Status:       Subscribed

Product Name: Stackable with Awesome OS for x86_64 Bits
Status:       Subscribed

Product Name: Awesome OS for x86_64/i686/ia64/ppc/ppc64/s390x/s390 Bits
Status:       Subscribed

Product Name: Exempt Product Bits
Status:       Not Subscribed

Product Name: Awesome OS Workstation Bits
Status:       Subscribed

Product Name: Red Hat Enterprise Linux Server
Status:       Not Subscribed

Product Name: Admin OS Premium Architecture Bits
Status:       Subscribed

Product Name: Admin OS Developer Bits
Status:       Subscribed

Product Name: Multiplier Product Bits
Status:       Subscribed

Product Name: Awesome OS OStree Bits
Status:       Subscribed

Product Name: Awesome OS Developer Bits
Status:       Subscribed

Product Name: Management Bits
Status:       Subscribed

Product Name: Large File Support Bits
Status:       Subscribed

Product Name: Virt Only Awesome OS for i386 Bits
Status:       Subscribed

Product Name: Clustering Bits
Status:       Subscribed

Product Name: Shared Storage Bits
Status:       Subscribed

Product Name: Awesome OS Server Bits
Status:       Subscribed

Product Name: Awesome OS Premium Architecture Bits
Status:       Subscribed

Product Name: Awesome OS for S390 Bits
Status:       Subscribed

Product Name: Awesome OS for i686 Bits
Status:       Subscribed

Product Name: Awesome OS for x86_64 Bits
Status:       Subscribed

Product Name: Awesome OS for ppc64 Bits
Status:       Subscribed

Product Name: Awesome OS for S390X Bits
Status:       Subscribed

Product Name: Awesome OS for i386 Bits
Status:       Subscribed

Product Name: Awesome OS for All Arch (all per arch content) Bits
Status:       Subscribed

Product Name: Awesome OS for All Arch (x86 content) Bits
Status:       Subscribed

Product Name: Awesome OS for All Arch (excpt for x86_64 content) Bits
Status:       Subscribed

Product Name: Awesome OS for All Arch (just x86_64 content) Bits
Status:       Subscribed

Product Name: Awesome OS for x86 Bits
Status:       Subscribed

Product Name: Awesome OS Instance Server Bits
Status:       Subscribed

Product Name: Shared File System Bits
Status:       Subscribed

Product Name: Multi-Attribute Limited Product
Status:       Subscribed

Product Name: Awesome Hypervisor Bits
Status:       Subscribed

Product Name: Snowy OS Premium Architecture Bits
Status:       Not Subscribed

Product Name: Awesome OS Docker Bits
Status:       Subscribed

Product Name: Awesome OS Modifier Bits
Status:       Subscribed

Product Name: RAM Limiting Product
Status:       Subscribed

Product Name: Snowy OS Developer Bits
Status:       Not Subscribed

Product Name: Core Limiting Product
Status:       Subscribed

Product Name: Load Balancing Bits
Status:       Subscribed

Unable to find available subscriptions for all your installed products.
[root@jsefler-6 ~]#
[root@jsefler-6 ~]# subscription-manager list --consumed
+-------------------------------------------+
   Consumed Subscriptions
+-------------------------------------------+
Subscription Name:   Development SKU Product
Provides:            Awesome OS for i686 Bits
                     Virt Only Awesome OS for i386 Bits
                     Awesome OS for ppc64 Bits
                     Awesome OS for i386 Bits
                     Awesome OS for x86_64/i686/ia64/ppc/ppc64/s390x/s390 Bits
                     Admin OS Premium Architecture Bits
                     Awesome OS for All Arch (all per arch content) Bits
                     Large File Support Bits
                     Awesome OS for All Arch (excpt for x86_64 content) Bits
                     Awesome OS Modifier Bits
                     Core Limiting Product
                     Awesome OS Docker Bits
                     Stackable with Awesome OS for x86_64 Bits
                     Awesome OS Premium Architecture Bits
                     Awesome OS Server Bits
                     Load Balancing Bits
                     Awesome Hypervisor Bits
                     Awesome OS for ia64 Bits
                     Awesome OS for x86_64 Bits
                     Awesome OS for S390X Bits
                     Admin OS Developer Bits
                     Awesome OS Instance Server Bits
                     Awesome OS Developer Bits
                     Multiplier Product Bits
                     Clustering Bits
                     Awesome OS for All Arch (just x86_64 content) Bits
                     Awesome OS for All Arch (x86 content) Bits
                     Awesome OS Workstation Bits
                     Management Bits
                     Shared File System Bits
                     Shared Storage Bits
                     Awesome OS OStree Bits
                     Awesome OS for x86 Bits
                     Awesome OS for S390 Bits
                     RAM Limiting Product
                     Multi-Attribute Limited Product
SKU:                 dev-sku-product
Contract:            
Account:             
Serial:              2566480277300212699
Pool ID:             8a90879051b19c410151b5c2fdb808e5
Provides Management: No
Active:              True
Quantity Used:       1
Service Level:       Premium
Service Type:        Level 3
Status Details:      Subscription is current
Subscription Type:   
Starts:              12/18/2015
Ends:                03/02/2016
System Type:         Physical

[root@jsefler-6 ~]# 

SO FAR THIS LOOKS GREAT - I SUCCESSFULLY GOT A CDK ENTITLEMENT AS EXPECTED.
Now I'll attach a Standard subscription...

[root@jsefler-6 ~]# subscription-manager list --avail --matches awesomeos-virt-unlimited
+-------------------------------------------+
    Available Subscriptions
+-------------------------------------------+
Subscription Name:   Awesome OS with unlimited virtual guests
Provides:            Awesome OS Server Bits
SKU:                 awesomeos-virt-unlimited
Contract:            0
Pool ID:             8a90879051a7c3760151a7c4df7e07a9
Provides Management: No
Available:           Unlimited
Suggested:           1
Service Level:       Self-Service
Service Type:        
Subscription Type:   Standard (Temporary)
Ends:                12/13/2016
System Type:         Virtual

Subscription Name:   Awesome OS with unlimited virtual guests
Provides:            Awesome OS Server Bits
SKU:                 awesomeos-virt-unlimited
Contract:            0
Pool ID:             8a90879051a7c3760151a7c4df4507a2
Provides Management: No
Available:           5
Suggested:           1
Service Level:       Self-Service
Service Type:        
Subscription Type:   Standard
Ends:                12/13/2016
System Type:         Physical

[root@jsefler-6 ~]# subscription-manager attach --pool 8a90879051a7c3760151a7c4df4507a2
Successfully attached a subscription for: Awesome OS with unlimited virtual guests
1 local certificate has been deleted.
[root@jsefler-6 ~]# 
[root@jsefler-6 ~]# subscription-manager list --consumed
+-------------------------------------------+
   Consumed Subscriptions
+-------------------------------------------+
Subscription Name:   Development SKU Product
Provides:            Awesome OS for i686 Bits
                     Virt Only Awesome OS for i386 Bits
                     Awesome OS for ppc64 Bits
                     Awesome OS for i386 Bits
                     Awesome OS for x86_64/i686/ia64/ppc/ppc64/s390x/s390 Bits
                     Admin OS Premium Architecture Bits
                     Awesome OS for All Arch (all per arch content) Bits
                     Large File Support Bits
                     Awesome OS for All Arch (excpt for x86_64 content) Bits
                     Awesome OS Modifier Bits
                     Core Limiting Product
                     Awesome OS Docker Bits
                     Stackable with Awesome OS for x86_64 Bits
                     Awesome OS Premium Architecture Bits
                     Awesome OS Server Bits
                     Load Balancing Bits
                     Awesome Hypervisor Bits
                     Awesome OS for ia64 Bits
                     Awesome OS for x86_64 Bits
                     Awesome OS for S390X Bits
                     Admin OS Developer Bits
                     Awesome OS Instance Server Bits
                     Awesome OS Developer Bits
                     Multiplier Product Bits
                     Clustering Bits
                     Awesome OS for All Arch (just x86_64 content) Bits
                     Awesome OS for All Arch (x86 content) Bits
                     Awesome OS Workstation Bits
                     Management Bits
                     Shared File System Bits
                     Shared Storage Bits
                     Awesome OS OStree Bits
                     Awesome OS for x86 Bits
                     Awesome OS for S390 Bits
                     RAM Limiting Product
                     Multi-Attribute Limited Product
SKU:                 dev-sku-product
Contract:            
Account:             
Serial:              1386671290420756388
Pool ID:             8a90879051b19c410151b5c2fdb808e5
Provides Management: No
Active:              True
Quantity Used:       1
Service Level:       Premium
Service Type:        Level 3
Status Details:      Subscription is current
Subscription Type:   
Starts:              12/18/2015
Ends:                03/02/2016
System Type:         Physical

Subscription Name:   Awesome OS with unlimited virtual guests
Provides:            Awesome OS Server Bits
SKU:                 awesomeos-virt-unlimited
Contract:            0
Account:             12331131231
Serial:              1125655288609992587
Pool ID:             8a90879051a7c3760151a7c4df4507a2
Provides Management: No
Active:              True
Quantity Used:       1
Service Level:       Self-Service
Service Type:        
Status Details:      Subscription is current
Subscription Type:   
Starts:              12/14/2015
Ends:                12/13/2016
System Type:         Physical

[root@jsefler-6 ~]# 

STILL LOOKS GOOD.
Now let's attempt another autosubscribe which should theoretically re-issue my CDK entitlement....

[root@jsefler-6 ~]# subscription-manager attach --auto


Installed Product Current Status:
Product Name: Awesome OS for ia64 Bits
Status:       Subscribed

Product Name: Stackable with Awesome OS for x86_64 Bits
Status:       Subscribed

Product Name: Awesome OS for x86_64/i686/ia64/ppc/ppc64/s390x/s390 Bits
Status:       Subscribed

Product Name: Exempt Product Bits
Status:       Not Subscribed

Product Name: Awesome OS Workstation Bits
Status:       Subscribed

Product Name: Red Hat Enterprise Linux Server
Status:       Not Subscribed

Product Name: Admin OS Premium Architecture Bits
Status:       Subscribed

Product Name: Admin OS Developer Bits
Status:       Subscribed

Product Name: Multiplier Product Bits
Status:       Subscribed

Product Name: Awesome OS OStree Bits
Status:       Subscribed

Product Name: Awesome OS Developer Bits
Status:       Subscribed

Product Name: Management Bits
Status:       Subscribed

Product Name: Large File Support Bits
Status:       Subscribed

Product Name: Virt Only Awesome OS for i386 Bits
Status:       Subscribed

Product Name: Clustering Bits
Status:       Subscribed

Product Name: Shared Storage Bits
Status:       Subscribed

Product Name: Awesome OS Server Bits
Status:       Subscribed

Product Name: Awesome OS Premium Architecture Bits
Status:       Subscribed

Product Name: Awesome OS for S390 Bits
Status:       Subscribed

Product Name: Awesome OS for i686 Bits
Status:       Subscribed

Product Name: Awesome OS for x86_64 Bits
Status:       Subscribed

Product Name: Awesome OS for ppc64 Bits
Status:       Subscribed

Product Name: Awesome OS for S390X Bits
Status:       Subscribed

Product Name: Awesome OS for i386 Bits
Status:       Subscribed

Product Name: Awesome OS for All Arch (all per arch content) Bits
Status:       Subscribed

Product Name: Awesome OS for All Arch (x86 content) Bits
Status:       Subscribed

Product Name: Awesome OS for All Arch (excpt for x86_64 content) Bits
Status:       Subscribed

Product Name: Awesome OS for All Arch (just x86_64 content) Bits
Status:       Subscribed

Product Name: Awesome OS for x86 Bits
Status:       Subscribed

Product Name: Awesome OS Instance Server Bits
Status:       Subscribed

Product Name: Shared File System Bits
Status:       Subscribed

Product Name: Multi-Attribute Limited Product
Status:       Subscribed

Product Name: Awesome Hypervisor Bits
Status:       Subscribed

Product Name: Snowy OS Premium Architecture Bits
Status:       Not Subscribed

Product Name: Awesome OS Docker Bits
Status:       Subscribed

Product Name: Awesome OS Modifier Bits
Status:       Subscribed

Product Name: RAM Limiting Product
Status:       Subscribed

Product Name: Snowy OS Developer Bits
Status:       Not Subscribed

Product Name: Core Limiting Product
Status:       Subscribed

Product Name: Load Balancing Bits
Status:       Subscribed

Unable to find available subscriptions for all your installed products.
[root@jsefler-6 ~]# 
BANG! look below at the Traceback in the rhsm.log

[root@jsefler-6 ~]# subscription-manager list --consumed | grep Serial
Serial:              1386671290420756388
Serial:              1125655288609992587

^Notice that my consumed entitlement serials remain unchanged.  I expected a re-issued CDK entitlement.



Actual results:
[root@jsefler-6 ~]# tail -f /var/log/rhsm/rhsm.log

2015-12-18 10:49:58,821 [DEBUG] subscription-manager:26720 @connection.py:530 - Making request: POST /candlepin/consumers/0109ddda-dd4f-4802-b01d-6ab5201715ac/entitlements
2015-12-18 10:49:58,880 [DEBUG] subscription-manager:26720 @cache.py:110 - Wrote cache: /var/lib/rhsm/cache/entitlement_status.json
2015-12-18 10:49:59,303 [DEBUG] subscription-manager:26720 @connection.py:562 - Response: status=500, requestUuid=132e9e41-71cc-4fe6-9596-09d967f695f9
2015-12-18 10:49:59,306 [WARNING] subscription-manager:26720 @managercli.py:201 - Error during auto-attach.
2015-12-18 10:49:59,307 [ERROR] subscription-manager:26720 @managercli.py:202 - Runtime Error null at org.hibernate.engine.internal.StatefulPersistenceContext.getLoadedCollectionOwnerOrNull:859
Traceback (most recent call last):
  File "/usr/share/rhsm/subscription_manager/managercli.py", line 197, in autosubscribe
    ents = cp.bind(consumer_uuid)  # new style
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 1148, in bind
    return self.conn.request_post(method)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 657, in request_post
    return self._request("POST", method, params)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 571, in _request
    self.validateResponse(result, request_type, handler)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 621, in validateResponse
    raise RestlibException(response['status'], error_msg, response.get('headers'))
RestlibException: Runtime Error null at org.hibernate.engine.internal.StatefulPersistenceContext.getLoadedCollectionOwnerOrNull:859

Comment 1 Michael Stead 2015-12-18 16:25:09 UTC
I've only been able to reproduct this in candlepin-2.0.10+ and not in candlepin-0.9.51.13-1.

Could you please attempt to reproduce this against 0.9.51.13-1 to make sure?

In the mean time, I'll try and find a fix in master.

Comment 2 Michael Stead 2015-12-18 19:33:44 UTC
Fix pending review:
https://github.com/candlepin/candlepin/pull/1051

I believe this bug will only affect 2.0 (master) due to the change in our Pool/Product references.

I'll test again on candlepin-0.9.51.13-1 just to double check.

Comment 3 Michael Stead 2016-01-05 20:40:20 UTC
Could not reproduce in 0.9.51. Fix merged into master branch for 2.0

Comment 4 Barnaby Court 2016-07-22 14:52:20 UTC
Marking as closed per Candlepin procedures as a fix has been merged or it has been determined to not be an issue.


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