CI Step Hangs Until Timeout - Diagnose Stuck Processes
A step stops producing output and sits silent until the job timeout kills it. The process is not crashed - it is stuck, waiting on something that will never arrive.
What this error means
The log goes quiet mid-step. No progress, no error - just silence until the job hits its timeout and is cancelled. Often the last line is a command that waits: a prompt, a network read, or a long-running watcher started in the foreground.
Run ./scripts/deploy.sh
Waiting for service to become healthy...
# (no further output for 30 minutes)
##[error] The operation was canceled.Common causes
A process is waiting on input or a TTY
A command expecting interactive input (a confirmation prompt, a password, a pager) blocks forever in CI where there is no TTY to answer it.
A blocking network call with no timeout
A request to a service that never responds, with no client timeout, hangs the step indefinitely until the job-level timeout intervenes.
A foreground long-running process
Starting a dev server, watcher, or tail -f in the foreground without backgrounding it means the step never returns.
How to fix it
Add per-step and per-command timeouts
Bound the wait so a hang fails fast instead of consuming the whole job.
timeout 300 ./scripts/deploy.sh # fail after 5 min instead of hanging
# and at the job level:
# timeout-minutes: 15Make commands non-interactive
- Pass non-interactive flags (
-y,--no-input,CI=true,DEBIAN_FRONTEND=noninteractive). - Background long-running processes and poll for readiness with a bounded loop.
- Set explicit client timeouts on every network call in scripts.
How to prevent it
- Always set per-step timeouts in addition to a job timeout.
- Run commands non-interactively in CI.
- Give every network/health-check call a bounded timeout.