Note: This is a beta release of Red Hat Bugzilla 5.0. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Also email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback here.
Bug 1685366 - auto-attaching to Satellite6.5 with a servicelevel causes 'Required lock: update Conflicts with tasks:'
Summary: auto-attaching to Satellite6.5 with a servicelevel causes 'Required lock: upd...
Keywords:
Status: NEW
Alias: None
Product: Red Hat Enterprise Linux 8
Classification: Red Hat
Component: subscription-manager
Version: 8.0
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: rc
: ---
Assignee: candlepin-bugs
QA Contact: Red Hat subscription-manager QE Team
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-03-05 03:50 UTC by qianzhan
Modified: 2019-03-19 19:27 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed:
Type: Bug
Target Upstream Version:


Attachments (Terms of Use)
rhsm.log (deleted)
2019-03-05 03:53 UTC, qianzhan
no flags Details

Description qianzhan 2019-03-05 03:50:16 UTC
Description of problem:
auto-attaching to Satellite6.5 causes 'Required lock: update Conflicts with tasks:'

Version-Release number of selected component (if applicable):
subscription-manager-1.23.8-33.el8.x86_64
dnf-plugin-subscription-manager-1.23.8-33.el8.x86_64
subscription-manager-cockpit-1.23.8-33.el8.noarch
python3-subscription-manager-rhsm-1.23.8-33.el8.x86_64
subscription-manager-rhsm-certificates-1.23.8-33.el8.x86_64
tfm-rubygem-katello-3.10.0.24-1.el7sat.noarch
katello-3.10.0-0.6.rc1.el7sat.noarch
candlepin-2.5.8-1.el7.noarch

How reproducible:
always

Steps to Reproduce:
1. Register RHEL-8.0.0-20190228.1 against Satellite6.5-snapshot-18.0:
[root@ent-01-vm-03 ~]# subscription-manager  register
Registering to: ent-01-vm-01.lab.eng.nay.redhat.com:443/rhsm
Username: admin
Password: 
The system has been registered with ID: 8dba7f9a-0a64-437f-92dd-b0dfacd13f34
The registered system name is: ent-01-vm-03.lab.eng.nay.redhat.com

2. Run auto-attach on client:
[root@ent-01-vm-03 ~]# subscription-manager subscribe --auto --servicelevel=Premium
Internal Server Error): Required lock is already taken by other running tasks.
Please inspect their state, fix their errors and resume them.

Required lock: update
Conflicts with tasks:
  https://ent 01 vm 01.lab.eng.nay.redhat.com/foreman_tasks/tasks/f506ee1f 525a 4f2d 9e35 283d20501952

Service level set to: Premium
Installed Product Current Status:
Product Name: Red Hat Enterprise Linux for x86_64
Status:       Subscribed

Actual results:
As step 2, a task conflicts happen.

Expected results:
No task conflict with auto-attaching.

Additional info:
Please check attachment 'rhsm.log'

Comment 3 qianzhan 2019-03-05 03:53:20 UTC
Created attachment 1540800 [details]
rhsm.log

Comment 4 Chris Snyder 2019-03-05 15:23:34 UTC
Looks to me like this might be caused by too many consumer updates in one command executed by subscription-manager.

Specifically, when the subscribe command (now called 'attach') is run we perform (given then parameters in the bug) the following calls:

1) getCertificateSerials  ( GET /consumers/<consumer_id>/certificates/serials )

2) getCertificates (if there are missing entitlement certificates on the system) ( GET /consumers/<consumer_id>/certificates?serials=<missing_ent_serial1>,<missing_ent_serial2>... )

3) updateConsumer (if the facts have changed on the system) ( PUT /consumers/<consumer_id> body includes all facts as json)

4) updateCombinedProfile (if the rpm, module or repo profile has changed) ( PUT /consumers/<consumer_id>/profiles body will include json of profile info)

5) updateConsumer (with updated installed products, if the installed products have changed) ( PUT /consumers/<consumer_id> body includes all installed products as json)

6) getConsumer (to updated the identity certificate for the system) ( GET /consumers/<consumer_id> )

7) getConsumer (to read the syspurpose attributes set server-side) ( GET /consumers/<consumer_id> )

8) updateConsumer (with updated syspurpose information) ( PUT /consumers/<consumer_id> body includes all syspurpose info as json)

9) getConsumer (because the --servicelevel option was given, check to see if the server supports servicelevel) ( GET /consumers/<consumer_id> )

10) updateConsumer (because the servicelevel option was given, update the servicelevel on the consumer to that before attempting auto attach) ( PUT /consumers/<consumer_id> body includes the service level)

11) bind (aka auto attach) ( POST /consumers/<consumer_id>/entitlements )

12) updateConsumer (new service level set means syspurpose must be synced again) ( PUT /consumers/<consumer_id> body includes all syspurpose info as json)


I think the numerous potential calls to updateConsumer (especially 10 and 12 being so close together in time) could be causing this issue.


Does the issue happen if you set the service level on the system after registration but prior to auto-attaching?

`subscription-manager service-level --set Premium`
`subscription-manager attach --auto`

Comment 5 qianzhan 2019-03-06 03:26:16 UTC
Hi Chris,

I tried as you recommended, and there is no task conflicts when executing SLA setting and auto-attaching respectively:

[root@ent-01-vm-03 ~]# subscription-manager service-level --set Premium
service_level_agreement set to "Premium".

[root@ent-01-vm-03 ~]# subscription-manager attach --auto
Installed Product Current Status:
Product Name: Red Hat Enterprise Linux
              for x86_64
Status:       Subscribed

Comment 7 qianzhan 2019-03-14 09:09:23 UTC
Can NOT reproduce this bug on RHEL-8.0.0-20190313.0 against Satellite6.5-snapshot19.0:

subscription-manager-1.23.8-35.el8.x86_64
dnf-plugin-subscription-manager-1.23.8-35.el8.x86_64
subscription-manager-cockpit-1.23.8-35.el8.noarch
python3-subscription-manager-rhsm-1.23.8-35.el8.x86_64
subscription-manager-rhsm-certificates-1.23.8-35.el8.x86_64
tfm-rubygem-katello-3.10.0.26-3.el7sat.noarch
katello-3.10.0-0.6.rc1.el7sat.noarch
candlepin-2.5.11-1.el7.noarch


1. [root@kvm-01-guest07 ~]# subscription-manager  register
Registering to: ent-01-vm-01.lab.eng.nay.redhat.com:443/rhsm
Username: admin
Password: 
The system has been registered with ID: 67bfbb7f-4009-4f29-a656-c05ec73a0939
The registered system name is: kvm-01-guest07.rhts.eng.tlv.redhat.com

2.
[root@kvm-01-guest07 ~]# subscription-manager subscribe --auto --servicelevel=Premium
Service level set to: Premium
Installed Product Current Status:
Product Name: Red Hat Enterprise Linux for x86_64
Status:       Subscribed

Comment 9 qianzhan 2019-03-19 03:54:59 UTC
Can not reproduce this bug on RHEL-8.0.0-20190313.0 against Satellite6.4.2:


ubscription-manager-1.23.8-35.el8.x86_64
dnf-plugin-subscription-manager-1.23.8-35.el8.x86_64
subscription-manager-cockpit-1.23.8-35.el8.noarch
python3-subscription-manager-rhsm-1.23.8-35.el8.x86_64
subscription-manager-rhsm-certificates-1.23.8-35.el8.x86_64
tfm-rubygem-katello-3.7.0.46-1.el7sat.noarch
katello-3.7.0-8.el7sat.noarch
candlepin-2.4.8-1.el7.noarch


[root@kvm-02-guest09 ~]# subscription-manager subscribe --auto --servicelevel=Premium
Service level set to: Premium
Installed Product Current Status:
Product Name: Red Hat Enterprise Linux for x86_64
Status:       Subscribed


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