Bug #28631
openRunHostJob tasks may stuck forever if the main task (RunHostsJob) is terminated abnormally.
Description
Cloned from https://bugzilla.redhat.com/show_bug.cgi?id=1785904
Description of problem:
RunHostJob tasks may stuck forever if the main task (RunHostsJob) is terminated abnormally.
Steps to Reproduce:
1. Create an ansible job invocation that will run on hundreds of hosts
2. Wait for the main task (RunHostsJob) to be in "running" state and some sub tasks (RunHostJob <hostname>) are created.
3. Restart foreman-tasks.
4. Check the status of the main task. Ensure that it is failed with the following error:
2: Actions::RemoteExecution::RunHostsJob (skipped) [ 258.62s / 0.06s ] Sub plans
Started at: 2019-12-22 03:57:27 UTC
Ended at: 2019-12-22 04:01:45 UTC
Real time: 258.62s
Execution time (excluding suspended state): 0.06s
Input:
---
job_invocation:
id: 129
name: Ansible Commands
description: Run echo date
job_category: Ansible Commands
job_invocation_id: 129
current_request_id:
current_timezone: Australia/Brisbane
current_user_id: 4
current_organization_id: 1
current_location_id:
Output:
--- {}
Error:
StandardError
Abnormal termination (previous state: running)
5. Noticed that the sub tasks are stuck on "running" state and never finish.
Actual results:
Sub tasks stuck forever.
Expected results:
Should either cancel the sub tasks or let them proceed.
No data to display