Windows 8 Task Scheduler retries without duplicate writes
0 reputation · 01 Mar 2022, 18:20 UTC
0 reputation · 01 Mar 2022, 18:20 UTC
Windows 8 Task Scheduler can restart a task after a failed attempt, but restart policy does not itself prevent repeated side effects. The goal is to define a failure contract for actions that append files, update records, or submit external requests, so an automatic restart cannot silently duplicate work.
The missing constraint is an idempotency boundary. A task may have completed a durable write before reporting failure, and manual starts or overlapping instances may also repeat execution. The contract must state which outcomes count as failure, whether partial effects survive, and whether each attempt represents the same logical operation. Windows 8 is end-of-support, so this behavior should be validated on that platform rather than inferred from newer releases, including partial-write and complete-write failure cases.
Should automatic restart be disabled for actions without idempotency protection, or allowed only when the action provides an atomic commit or stable operation identifier? Which partial-success outcomes should be classified as retryable?
37775 reputation · 02 Mar 2022, 00:20 UTC
Disable automatic restart for any action that lacks idempotency protection. Enable restart only when the action guarantees exactly-once semantics through an atomic commit, a stable operation identifier checked before mutation, or an external service that deduplicates by client-generated ID. Partial-success outcomes are retryable only when no durable write, record, or external submit has occurred — or when the action verifies and skips on re-run.
Windows 8 Task Scheduler's "Restart task on failure" setting re-launches the entire program or script as a fresh process. It observes only the exit code: zero means success, non-zero means failure. It has no visibility into partial file writes, committed database rows, or HTTP requests already sent. Each retry is a clean execution from the start, so any side effect that survived the first attempt will be repeated.
This behavior is identical to Windows 7 and Server 2012 R2. No hotfix added idempotency awareness. Because Windows 8 reached end-of-support in January 2016, you must validate on actual Windows 8 media — Windows 10/11 behavior is not evidence for Windows 8.
A restart-safe action must satisfy all of the following:
| Outcome | Retryable? | Reason |
|---|---|---|
| Transient network/timeout before any durable write | Yes | State unchanged |
| Resource unavailable (locked file, DB down) with no mutation | Yes | State unchanged |
| Action returns explicit "retry later" exit code | Yes | Contract-defined |
| File append, DB insert, or HTTP POST may have completed | No | Durable effect survives restart |
| Partial write (e.g., wrote header, crashed before footer) | No | Partial effect survives and repeats |
What is the exact exit code mapping your action currently returns for each failure mode? Without this, you cannot classify which codes are retryable versus non-retryable in the failure contract.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.