hashicorp/nomad · error
timeout exceeded waiting for process
Error message
timeout exceeded waiting for process
What it means
waitFor polls a Windows process/service state on a timer and returns this error when the caller's context is done before the operation reports complete. It is the timeout signal for Start, Stop, and stub-service deletion operations on Windows services.
Source
Thrown at helper/winsvc/windows_service_windows.go:252
pauseDur := time.Millisecond * 250
t, timerStop := helper.NewSafeTimer(pauseDur)
defer timerStop()
for {
t.Reset(pauseDur)
complete, err := condition()
if err != nil {
return err
}
if complete {
return nil
}
select {
case <-ctx.Done():
return fmt.Errorf("timeout exceeded waiting for process")
case <-t.C:
}
}
}
View on GitHub (pinned to 482b49bf1a)
Solutions
- Inspect the Windows service/event log (sc query, Event Viewer) to find why the process is not reaching the expected state.
- Increase the wait timeout/deadline passed to Start/Stop via the context.
- Fix the underlying service hang: check for blocking dependencies, deadlocks, or slow disk/network at startup or shutdown.
- Retry the stop/start operation after confirming the process state with the Service Control Manager.
Example fix
// before ctx := context.Background() // no deadline; or too-short timeout // after ctx, cancel := context.WithTimeout(context.Background(), 60*time.Second) defer cancel()
Defensive patterns
Strategy: retry
Validate before calling
// Before Stop/Start, check current state
state, _ := svc.Query()
if state == svc.Stopped { /* skip Stop */ } Try / catch
err := manager.Stop(timeout)
if err != nil && strings.Contains(err.Error(), "timeout exceeded waiting for process") {
// inspect service state/event log, optionally retry once with longer timeout
} Prevention
- Use generous deadlines proportional to service startup/shutdown cost.
- Watch Event Viewer for the service binary hanging.
- Avoid stopping services during resource contention windows.
When it happens
Trigger: Start, Stop, deleteStubService, or an anonymous caller invoking waitFor when the service/process does not reach its expected state before the context deadline (ctx.Done()) fires.
Common situations: Service binary hangs or blocks during startup/shutdown; service depends on a slow resource; SCM stop request deadlocks; system under heavy load; the configured wait timeout is too short for slow machines.
Understand the failure class
- Timeouts: ETIMEDOUT, deadlines, and hung requests — what actually expires when a request times out.
Related errors
- could not start service - %w
- Failed to open Windows eventlog: %w
- rcp.connection_write_timeout must be greater than zero
- rcp.stream_close_timeout must be greater than zero
- rcp.stream_open_timeout must be greater than zero
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/a0708050b8c6cdeb.
Report an issue: GitHub.