Bug 1781671

Summary: While using concurrency_level in remote execution, job progress in WebUI is not being updated properly
Product: Red Hat Satellite Reporter: Barbora Vassova <bvassova>
Component: Remote ExecutionAssignee: Adam Ruzicka <aruzicka>
Status: CLOSED ERRATA QA Contact: Peter Ondrejka <pondrejk>
Severity: medium Docs Contact:
Priority: urgent    
Version: 6.6.0CC: aruzicka, eero.torri, fperalta, hakon.gislason, hyu, inecas, janarula, kkinge, kkohli, mkalyat, mmccune, pierre-yves.goubet, pmoravec, satellite6-bugs, smutkule, wclark
Target Milestone: 6.8.0Keywords: Triaged
Target Release: Unused   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1832580 1851137 (view as bug list) Environment:
Last Closed: 2020-10-27 12:59:35 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:
Attachments:
Description Flags
hotfixed tfm-rubygem-foreman-tasks RPM for Satellite 6.6.2
none
hotfixed tfm-rubygem-foreman_remote_execution RPM for Satellite 6.6.2
none
UPDATED tfm-rubygem-foreman_remote_execution hotfix RPM none

Description Barbora Vassova 2019-12-10 11:30:25 UTC
Description of problem:
While using concurrency_level in remote execution, job progress in WebUI is not being updated properly and it seems to add a 10 minute delay.  

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

How reproducible:
always

Steps to Reproduce:
1. Create a job on 3 hosts (I used SSH Default template), for example "ls" 
2. Run the job without concurrency_level set up, then with concurrency_level = 1 and also with concurrency_level = 2 
3. Observe the times of jobs being finished.

Actual results:
concurrency_level not set up: ~ 1 minute

Remote action: Run ls on host3	stopped	success	2019-12-10 11:36:19 +0100	2019-12-10 11:36:48 +0100	admin
Remote action: Run ls on host1	stopped	success	2019-12-10 11:36:18 +0100	2019-12-10 11:36:48 +0100	admin
Remote action: Run ls on host2	stopped	success	2019-12-10 11:36:18 +0100	2019-12-10 11:36:48 +0100	admin
Run hosts job: Run ls	stopped	success	2019-12-10 11:36:09 +0100	2019-12-10 11:36:58 +0100	admin

concurrency_level = 1: 20 minutes

Remote action: Run ls on host3	stopped	success	2019-12-10 11:37:19 +0100	2019-12-10 11:57:19 +0100	admin
Remote action: Run ls on host2	stopped	success	2019-12-10 11:37:18 +0100	2019-12-10 11:47:19 +0100	admin
Remote action: Run ls on host1	stopped	success	2019-12-10 11:37:18 +0100	2019-12-10 11:37:48 +0100	admin
Run hosts job: Run ls	stopped	success	2019-12-10 11:37:06 +0100	2019-12-10 11:57:27 +0100	admin

If you look at end times of the jobs, there seems to be a 10 minute delay.

concurrency_level = 2: 10 minutes

Remote action: Run ls on host3	stopped	success	2019-12-10 11:59:21 +0100	2019-12-10 12:09:19 +0100	admin
Remote action: Run ls on host1	stopped	success	2019-12-10 11:59:19 +0100	2019-12-10 11:59:49 +0100	admin
Remote action: Run ls on host2	stopped	success	2019-12-10 11:59:19 +0100	2019-12-10 11:59:49 +0100	admin
Run hosts job: Run ls	stopped	success	2019-12-10 11:59:08 +0100	2019-12-10 12:09:23 +0100	admin
 
Again, 10 minute delay for the third job. 

However, if during the execution you click on the actual jobs (on job invocation page), you can see the results (ls output) even when that particular job is still "planned" or "running". It seems that the actual command is being executed fast as expected - just WebUI information is delayed. Refreshing the page does not help. 

Expected results:
I would expect that if Satellite is able to run all 3 jobs at once in a minute, setting concurrency_level would make it around 3 minutes, in worst case. While the job itself seems to be executed like that, WebUI is not reflecting it.

Comment 3 Adam Ruzicka 2019-12-10 14:35:47 UTC
Connecting upstream issue to this BZ

Comment 5 Adam Ruzicka 2019-12-17 10:07:43 UTC
This won't probably be an easy fix. Until we have a fix ready, the following workaround can be used:

Go to Settings > Foreman Tasks > set 'foreman_tasks_proxy_batch_trigger' to false. Please note this can lead to degraded performance of remote execution in case you have *lots* of hosts.

Comment 10 Bryan Kearney 2020-01-02 15:06:03 UTC
Upstream bug assigned to aruzicka

Comment 11 Bryan Kearney 2020-01-02 15:06:04 UTC
Upstream bug assigned to aruzicka

Comment 13 Bryan Kearney 2020-01-27 15:05:59 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/28095 has been resolved.

Comment 15 Adam Ruzicka 2020-02-17 13:31:36 UTC
This also needs https://projects.theforeman.org/issues/28616. Moving back to ASSIGNED until the other patch is merged.

Comment 18 Bryan Kearney 2020-03-10 10:07:31 UTC
Moving this bug to POST for triage into Satellite 6 since the upstream issue https://projects.theforeman.org/issues/28616 has been resolved.

Comment 19 Hao Chang Yu 2020-03-25 11:14:20 UTC
(In reply to Adam Ruzicka from comment #5)
> This won't probably be an easy fix. Until we have a fix ready, the following
> workaround can be used:
> 
> Go to Settings > Foreman Tasks > set 'foreman_tasks_proxy_batch_trigger' to
> false. Please note this can lead to degraded performance of remote execution
> in case you have *lots* of hosts.

I tried this workaround but it is also broken. The jobs failed because ansible jobs are treated as a remote execution jobs. It is because the old API which is using the hardcoded "proxy_action_name" (ForemanRemoteExecutionCore::Actions::RunScript) is used to trigger the remote tasks. The patch for this bugzilla also fixed this issue.

Comment 21 wclark 2020-04-06 16:39:30 UTC
Created attachment 1676643 [details]
hotfixed tfm-rubygem-foreman-tasks RPM for Satellite 6.6.2

Comment 22 wclark 2020-04-06 16:40:17 UTC
Created attachment 1676644 [details]
hotfixed tfm-rubygem-foreman_remote_execution RPM for Satellite 6.6.2

Comment 23 wclark 2020-04-06 16:47:29 UTC
A hotfix for this issue is available for Satellite 6.6.2.

INSTALLATION INSTRUCTIONS:

1. Make a complete backup or snapshot of Satellite server

2. Download the attached hotfix RPMs from this BZ and copy them to Satellite server

3. # foreman-maintain packages unlock

4. # yum install ./tfm-rubygem-foreman_remote_execution-1.8.0.4-2.HOTFIXRHBZ1781671.el7sat.noarch.rpm ./tfm-rubygem-foreman-tasks-0.15.11.1-2.HOTFIXRHBZ1781671.el7sat.noarch.rpm

5. # foreman-maintain packages lock

6. # systemctl restart dynflowd httpd

Comment 24 wclark 2020-04-16 14:38:27 UTC
Created attachment 1679406 [details]
UPDATED tfm-rubygem-foreman_remote_execution hotfix RPM

There was an issue with the previous version of this RPM. Please use the newly uploaded version.

Comment 29 Peter Ondrejka 2020-06-25 09:03:32 UTC
Verified on Sat 6.8 snap 5, the concurrency level setting is accepted with foreman_tasks_proxy_batch_trigger true

Comment 32 errata-xmlrpc 2020-10-27 12:59:35 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 (Important: Satellite 6.8 release), 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/RHSA-2020:4366

Comment 33 Mike McCune 2020-11-03 17:42:11 UTC
The hotfix for 6.6.2 in this bugzilla is also applicable to 6.6.3 if needed.