Use this when steps must not hang forever.
Timeouts
Timeouts stop a step that runs too long, such as waiting for a device or API, so the job fails cleanly instead of hanging forever. Set them per step from realistic durations.
1. Timeouts prevent hung automation.
2. Set per call and overall.
3. Clean up after timeout.
4. Choose values from measurements.
5. Report timeouts clearly.
step → time limit → abort/cleanup on expiry
Context & applicabilityCommon mistakes · platform/version boundaries
Operational reference
Fast context before you go deeper.
Verification & Troubleshooting
Start with the observed symptom, prove the nearest boundary, and move outward only when the current state is understood.
Use the operational verification above to establish the expected state.
Capture the concrete output, symptom, packet, log or counter before changing anything.
Step 1 Verification path Verify boundary
The negative fixture should deliberately exercise risks such as implicit defaults, hidden dependencies, duplicate dispatch, worker drift, timeout without cancellation, retries against non-idempotent operations and confusing control-plane completion with target convergence, choosing the cases most relevant to connect/read/operation/global timeout separation, cancellation, safe retry and recording which timer actually fired.
Step 2 Common mistakes Narrow the fault
- No timeout on HTTP requests (Python
requestswaits forever by default). - Timeouts shorter than the normal operation time.
Evidence · 1 on this Topic
Expected observations and documentation recipes are reference material. Record actual output, device identity, scope and time before claiming a verified result.
- Every step that waits on something needs a timeout.
- Base timeouts on measured normal durations.
- On timeout, fail clearly and clean up.
timeout 60 <command>— shell timeout- Per-step and overall timeouts — configuration
- Timeout handling (cleanup) — safety
ReferenceWhy it matters1 section · depth on demand
What it is
Timeouts bound how long a step may run or wait. Set connect and read timeouts on every network call and an overall job timeout, so a hung target does not block the whole run.
ReferenceImportant terms & boundaries2 sections · depth on demand
In depth
Timeouts set the maximum time an operation may take. Every network call, command and job should have one; without them a single unresponsive system can hang automation indefinitely and block other work.
Choosing values:
1. Measure normal duration (median and worst case).
2. Set the timeout comfortably above the worst normal case.
3. Layer them: connection < operation < step < whole job.
4. Make them configurable for slow environments.
When a timeout fires, report what was being waited for and what state may have been left (an image copy that timed out may have partially written a file), and clean up or mark the target for verification.
Example
curl --connect-timeout 5 --max-time 30 https://api.example.com/health
timeout 300 ./long-task.sh
Additional reference context Scope · expected state · examples · history · terminology Open only when you need the supporting context
Verification history & basis
When and against what this Topic was checked. Later text edits do not count as a new check.
Authoritative/upstream documentation reviewed for bounded claims in Automation Design > Timeouts. Documentation verification only; this is not observed lab or production Evidence.
Basis: https://learn.microsoft.com/en-us/azure/well-architected/operational-excellence/enable-automation · confidence 94%Deep reference
Healthy vs suspicious evidence
Output interpretation
For connect/read/operation/global timeout separation, cancellation, safe retry and recording which timer actually fired, prefer typed fields and stable IDs over human presentation text.