Bug 1321246

Summary: Large host-to-guest mapping produces "StaleStateError: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1"
Product: [Retired] Subscription Asset Manager Reporter: Paul Wayper <pwayper>
Component: candlepinAssignee: Katello Bug Bin <katello-bugs>
Status: CLOSED WONTFIX QA Contact: SAM QE List <sam-qe-list>
Severity: high Docs Contact:
Priority: unspecified    
Version: 1.3CC: jalviso
Target Milestone: rc   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2017-06-26 20:35:51 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Attachments:
Description Flags
xzipped line containing the host to guest mapping. none

Description Paul Wayper 2016-03-25 05:35:29 UTC
Created attachment 1140236 [details]
xzipped line containing the host to guest mapping.

Description of problem:

When subscriptionmanager submits a large host-to-guest mapping (e.g. ~6,200 guests on 79 hosts), the following error is generated in /var/log/rhsm/rhsm.log:

2016-03-17 05:12:30,699 [ERROR]  @virtwho.py:123 - Error in communication with subscription manager:
Traceback (most recent call last):
  File "/usr/share/virt-who/virtwho.py", line 105, in send
    self._sendGuestAssociation(report)
  File "/usr/share/virt-who/virtwho.py", line 134, in _sendGuestAssociation
    result = manager.hypervisorCheckIn(report.config, report.association, report.config.type)
  File "/usr/share/virt-who/manager/subscriptionmanager/subscriptionmanager.py", line 134, in hypervisorCheckIn
    return self.connection.hypervisorCheckIn(config.owner, config.env, mapping)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 815, in hypervisorCheckIn
    return self.conn.request_post(url, host_guest_mapping)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 605, in request_post
    return self._request("POST", method, params)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 530, in _request
    self.validateResponse(result, request_type, handler)
  File "/usr/lib64/python2.6/site-packages/rhsm/connection.py", line 572, in validateResponse
    raise RestlibException(response['status'], error_msg)
RestlibException: Runtime Error org.hibernate.StaleStateException: Batch update returned unexpected row count from update [0]; actual row count: 0; expected: 1 at org.hibernate.jdbc.Expectations$BasicExpectation.checkBatched:81

The host-to-guest line is attached as it is large:

$ wc /tmp/host-to-guest-map.txt 
     1   6324 240162 /tmp/host-to-guest-map.txt

This analysis shows the content:

Host to guest mapping is 240054 characters long
mapped c6d4f6cc-d9d4-e111-8000-00000000008d to 44 guests
mapped 828d62c3-4ac7-4d5e-8944-1a6d899cdddc to 3 guests
mapped 6aa53a9f-f2be-e511-a10f-905555553939 to 1 guests
mapped ccf6d4c6-d4d9-11e1-8000-0000000000a5 to 111 guests
mapped ccf6d4c6-d4d9-11e1-8000-00000000008a to 85 guests
mapped ccf6d4c6-d4d9-11e1-8000-000000000099 to 85 guests
mapped ccf6d4c6-d4d9-11e1-8000-000000000098 to 12 guests
mapped 4b458732-bba3-e05c-90e3-8bbcd54eed98 to 1 guests
mapped ccf6d4c6-d4d9-11e1-8000-000000000074 to 125 guests
mapped c6d4f6cc-d9d4-e111-8000-00000000009d to 50 guests
mapped ccf6d4c6-d4d9-11e1-8000-000000000093 to 18 guests
mapped ccf6d4c6-d4d9-11e1-8000-000000000095 to 110 guests
mapped ccf6d4c6-d4d9-11e1-8000-000000000094 to 113 guests
mapped c6d4f6cc-d9d4-e111-8000-00000000009c to 79 guests
mapped ccf6d4c6-d4d9-11e1-8000-000000000096 to 93 guests
mapped ccf6d4c6-d4d9-11e1-8000-0000000000aa to 96 guests
mapped aa64c44f-10d9-bc58-b1e7-d4cc8870630a to 8 guests
mapped ccf6d4c6-d4d9-11e1-8000-0000000000ac to 102 guests
mapped ccf6d4c6-d4d9-11e1-8000-0000000000ab to 102 guests
mapped ccf6d4c6-d4d9-11e1-8000-00000000007b to 99 guests
mapped ccf6d4c6-d4d9-11e1-8000-00000000007a to 100 guests
mapped c6d4f6cc-d9d4-e111-8000-00000000004d to 83 guests
mapped ccf6d4c6-d4d9-11e1-8000-00000000005a to 105 guests
mapped ccf6d4c6-d4d9-11e1-8000-000000000075 to 90 guests
mapped ccf6d4c6-d4d9-11e1-8000-000000000055 to 128 guests
mapped ccf6d4c6-d4d9-11e1-8000-00000000005b to 96 guests
mapped ccf6d4c6-d4d9-11e1-8000-000000000064 to 112 guests
mapped ccf6d4c6-d4d9-11e1-8000-000000000065 to 93 guests
mapped ccf6d4c6-d4d9-11e1-8000-000000000066 to 101 guests
mapped ccf6d4c6-d4d9-11e1-8000-000000000067 to 125 guests
mapped c6d4f6cc-d9d4-e111-8000-00000000006d to 66 guests
mapped 4c4c4544-0047-4710-8044-c3c04f354c31 to 1 guests
mapped c6d4f6cc-d9d4-e111-8000-00000000007e to 43 guests
mapped ccf6d4c6-d4d9-11e1-8000-000000000063 to 91 guests
mapped ccf6d4c6-d4d9-11e1-8000-000000000059 to 101 guests
mapped c6d4f6cc-d9d4-e111-8000-00000000005c to 94 guests
mapped ccf6d4c6-d4d9-11e1-8000-000000000049 to 110 guests
mapped c6d4f6cc-d9d4-e111-8000-00000000005e to 52 guests
mapped c6d4f6cc-d9d4-e111-8000-00000000005d to 102 guests
mapped c6d4f6cc-d9d4-e111-8000-00000000006e to 70 guests
mapped ccf6d4c6-d4d9-11e1-8000-00000000009a to 78 guests
mapped ccf6d4c6-d4d9-11e1-8000-000000000078 to 112 guests
mapped c6d4f6cc-d9d4-e111-8000-00000000007d to 59 guests
mapped 6c15492c-d83e-db5b-8471-c316c278a4df to 6 guests
mapped ccf6d4c6-d4d9-11e1-8000-00000000009f to 37 guests
mapped c6d4f6cc-d9d4-e111-8000-00000000008c to 89 guests
mapped 36de3794-b05f-e511-988e-0894ef036c68 to 1 guests
mapped ccf6d4c6-d4d9-11e1-8000-000000000088 to 84 guests
mapped ccf6d4c6-d4d9-11e1-8000-000000000089 to 104 guests
mapped ccf6d4c6-d4d9-11e1-8000-000000000086 to 107 guests
mapped ccf6d4c6-d4d9-11e1-8000-000000000084 to 123 guests
mapped ccf6d4c6-d4d9-11e1-8000-000000000085 to 106 guests
mapped ccf6d4c6-d4d9-11e1-8000-000000000079 to 85 guests
mapped ccf6d4c6-d4d9-11e1-8000-000000000083 to 116 guests
mapped ccf6d4c6-d4d9-11e1-8000-00000000004b to 104 guests
mapped ccf6d4c6-d4d9-11e1-8000-00000000004c to 94 guests
mapped ccf6d4c6-d4d9-11e1-8000-00000000004a to 65 guests
mapped ccf6d4c6-d4d9-11e1-8000-00000000004f to 7 guests
mapped ccf6d4c6-d4d9-11e1-8000-00000000006a to 104 guests
mapped 44454c4c-4700-1033-804d-c4c04f4b5331 to 3 guests
mapped 8af83ac6-cb5a-173a-8b05-ee70aaace388 to 3 guests
mapped c6d4f6cc-d9d4-e111-8000-00000000004e to 52 guests
mapped 4c4c4544-0048-5210-8031-b1c04f425031 to 3 guests
mapped ccf6d4c6-d4d9-11e1-8000-000000000069 to 93 guests
mapped ccf6d4c6-d4d9-11e1-8000-000000000077 to 133 guests
mapped ccf6d4c6-d4d9-11e1-8000-000000000076 to 122 guests
mapped ccf6d4c6-d4d9-11e1-8000-0000000000a3 to 95 guests
mapped c6d4f6cc-d9d4-e111-8000-00000000006c to 115 guests
mapped ccf6d4c6-d4d9-11e1-8000-000000000073 to 92 guests
mapped ccf6d4c6-d4d9-11e1-8000-0000000000a4 to 119 guests
mapped ccf6d4c6-d4d9-11e1-8000-0000000000a7 to 116 guests
mapped ccf6d4c6-d4d9-11e1-8000-0000000000a6 to 116 guests
mapped ccf6d4c6-d4d9-11e1-8000-0000000000a9 to 106 guests
mapped ccf6d4c6-d4d9-11e1-8000-000000000054 to 131 guests
mapped ccf6d4c6-d4d9-11e1-8000-000000000057 to 105 guests
mapped ccf6d4c6-d4d9-11e1-8000-000000000056 to 111 guests
mapped c7716e2a-09a1-145c-b6f5-425088b11537 to 10 guests
mapped ccf6d4c6-d4d9-11e1-8000-000000000053 to 96 guests
mapped 4c4c4544-0059-3210-8037-b7c04f463032 to 31 guests
Total of 6233 guests on 79 hosts.

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

ruby193-rubygem-katello-redhat-access-engine-0.0.1-1.el6sam.noarch
subscription-manager-1.14.10-1.el6.x86_64
virt-who-0.12-10.el6.noarch

How reproducible:

Always

Steps to Reproduce:

1. Try to submit the attached host-to-guest mapping.

Actual results:

2. Host-to-guest mapping fails, machines from that datacentre do not get added to SAM.

Expected results:

2. Host-to-guest mapping submission works correctly.

Additional info:

Other updates of around 37,500 characters work correctly.  Is it possible that this is a limit in the HTTP POST value?  Should this data be encoded differently?

Comment 3 Bryan Kearney 2017-06-26 20:35:51 UTC
The release of Satellite 5.8 we are deprecating the support of Subscription Asset Manager. The release notes for 5.8 can be found at https://access.redhat.com/documentation/en-us/red_hat_satellite/5.8/pdf/release_notes/Red_Hat_Satellite-5.8-Release_Notes-en-US.pdf.

I am therefore closing out this bug as WONTFIX. If you believe this to be an error, please feel free tor each out to either Rich Jerrido or Bryan Kearney. Thank you!