Bug #22679
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 Pavel Moravec about 7 years ago
- Copied from Bug #22630: REX task using job template for reboot might hang despite reboot succeeded added
Updated by Pavel Moravec about 7 years ago
- Status changed from Ready For Testing to Closed
- % Done changed from 0 to 100
Applied in changeset community-templates|9d7f44815a154d49a4bd57bdbc59685f8b6edc18.