Bug #22630
closedREX task using job template for reboot might hang despite reboot succeeded
Description
After issuing a host reboot job through SSH-based REX, the job may remain in Pending state on Satellite. The host reboots just fine as expected but even after 18+ hours the task still shows Pending.
This happens just sometimes, with some random probability depending on several factors.
The problem is expected to appear in situation when the `reboot` command switches off network before the command returns success value back to `ssh`. Therefore, the `ssh` command is not properly completed.
A simple solution is to replace `reboot` by e.g. `shutdown -r +1` to delay the reboot by 1 minute, which allows the command and ssh to properly terminate. The negs is the reboot will happen with one minute delay.
We can try to come up with some bash tricks like:
(sleep 2; reboot) &
true
but I am afraid some gotchas can be found there as well - anyway I am open to any suggestion, the `shutdown -r +1` is just a proposal (with its own drawback).
PR for it on the way..
Updated by The Foreman Bot about 6 years ago
- Status changed from New to Ready For Testing
- Pull request https://github.com/theforeman/foreman_remote_execution/pull/319 added
Updated by Pavel Moravec about 6 years ago
- Pull request https://github.com/theforeman/community-templates/pull/456 added
Updated by Pavel Moravec about 6 years ago
- Copied to Bug #22679: REX task using job template for reboot might hang despite reboot succeeded added
Updated by Pavel Moravec about 6 years ago
Please close this ticket - work is done in http://projects.theforeman.org/issues/22679 and I dont have permissions to close this ticket..
Updated by Ewoud Kohl van Wijngaarden about 6 years ago
- Status changed from Ready For Testing to Duplicate