Repository navigation
cloud-init: terminate the machine even if the script hangs or dies - #2472
Merged
Merged
Conversation
A shutdown deadline (timeout + 2h) scheduled with systemd at the start, an EXIT trap, and --max-time on the uploads to the sink. Before, a hang outside of 'timeout' (git clone, dataset downloads, uploads, or a background server keeping the pipe of 'timeout ... | tee' open) left the machine running. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The cloud-init templates (main, versions, hardware) don't use
set -e, so failing commands already fall through to the finalshutdown now. But the machine kept running if the script hung or was killed before reaching it:timeout;git clone, the dataset downloads of the versions benchmark,mkfs/mdadm, and the uploads to the sink (curlwithout--max-time) are not;timeout ... | teekills only its direct child: a server the benchmark started in the background keeps the pipe open, andteewaits for it forever;shutdown.Changes, in all three templates:
shutdown -P +<timeout/60 + 120>: a deadline enforced by systemd regardless of the script; the finalshutdown nowreplaces it in the normal case;trap 'shutdown now' EXITfor early exits;curl --max-time 300for the uploads (no--retry: a retried POST could insert the row twice).The legacy manual
hardware/cloud-init.shgets a 10-hour deadline as well.🤖 Generated with Claude Code