Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
Red Hat Satellite engineering is moving the tracking of its product development work on Satellite to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "Satellite project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs will be migrated starting at the end of May. If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "Satellite project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/SAT-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 1558069

Summary: First bulk REX after smart_proxy_dynflow_core can raise "Could not use any Capsule" error
Product: Red Hat Satellite Reporter: Pavel Moravec <pmoravec>
Component: Remote ExecutionAssignee: Adam Ruzicka <aruzicka>
Status: CLOSED ERRATA QA Contact: Harshad More <hmore>
Severity: medium Docs Contact:
Priority: medium    
Version: 6.3.0CC: aruzicka, hmore, inecas, pcreech
Target Milestone: UnspecifiedKeywords: Triaged
Target Release: Unused   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1572292 (view as bug list) Environment:
Last Closed: 2018-06-19 20:17:00 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:
Embargoed:

Description Pavel Moravec 2018-03-19 14:38:39 UTC
Description of problem:
When having one Capsule for REX (or when only one Caps can be used for REX to some hosts), "Could not use any Capsule" error might happen after a fresh restart of smart_proxy_dynflow_core (spdc) service, any time delay, and then a bulk of REX jobs.

Per aruzicka++, it happens because:
- restarting or reloading this service itself does not load DB scheme nor apply DB migrations
- that is done during the very first REX job / probe of this Capsule "liveness"
- if multiple REX jobs are scheduled to the same time and multiple such queries "is this Capsule running?" are raised concurrently, a race condition followed by some SQL error in spdc logs can cause the probe fails
- if this Caps is the only available for some host, whole REX job for the host fails with "Could not use any Capsule" error



Version-Release number of selected component (if applicable):
any (incl. Sat 6.2.14 and 6.3.0)


How reproducible:
100% (in few attempts, the worst)


Steps to Reproduce:
0) Have Sat without another Caps and REX working to some host (1 is enough)

1) restart spdc service:
service smart_proxy_dynflow_core restart

2) invoke more REX jobs in near future:
cat "date" > /tmp/rex-date

# update --start-at to some soon-in-future time, and update "MYHOST" to some host you have, optionally update --job-template-id to SSH REX one

for i in $(seq 1 100); do echo "job-invocation create --job-template-id 94 --input-files command=/tmp/rex-date --search-query \"name ~ MYHOST\" --async --start-at \"2018-03-19T13:50:00\""; done | hammer -u admin -p redhat shell

3) observe if all jobs succeeded


Actual results:
3) few very first jobs (usually two) fail - not granted, depends on how fast they trigger the probe to spdc


Expected results:
3) no such errors


Additional info:
workaround: run a dummy REX job against that Capsule after any spdc service reload and/or restart

Comment 1 Adam Ruzicka 2018-03-19 14:55:19 UTC
Created redmine issue http://projects.theforeman.org/issues/22935 from this bug

Comment 3 Satellite Program 2018-03-19 16:14:01 UTC
Upstream bug assigned to aruzicka

Comment 4 Satellite Program 2018-03-19 16:14:04 UTC
Upstream bug assigned to aruzicka

Comment 5 Satellite Program 2018-03-20 14:14:03 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue http://projects.theforeman.org/issues/22935 has been resolved.

Comment 9 errata-xmlrpc 2018-06-19 20:17: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.

https://access.redhat.com/errata/RHBA-2018:1950