{"record":{"id":"b51aa67e9d2572a8","repo":"hashicorp/nomad","slug":"executor-error-waiting-on-process-v-b51aa6","errorCode":null,"errorMessage":"executor: error waiting on process: %v","messagePattern":"executor: error waiting on process: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/qemu/driver.go","lineNumber":835,"sourceCode":"\n// GetAbsolutePath returns the absolute path of the passed binary by resolving\n// it in the path and following symlinks.\nfunc GetAbsolutePath(bin string) (string, error) {\n\tlp, err := exec.LookPath(bin)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to resolve path to %q executable: %v\", bin, err)\n\t}\n\n\treturn filepath.EvalSymlinks(lp)\n}\n\nfunc (d *Driver) handleWait(ctx context.Context, handle *taskHandle, ch chan *drivers.ExitResult) {\n\tdefer close(ch)\n\tvar result *drivers.ExitResult\n\tps, err := handle.exec.Wait(ctx)\n\tif err != nil {\n\t\tresult = &drivers.ExitResult{\n\t\t\tErr: fmt.Errorf(\"executor: error waiting on process: %v\", err),\n\t\t}\n\t\t// if process state is nil, we've probably been killed, so return a reasonable\n\t\t// exit state to the handlers\n\t\tif ps == nil {\n\t\t\tresult.ExitCode = -1\n\t\t\tresult.OOMKilled = false\n\t\t}\n\t} else {\n\t\tresult = &drivers.ExitResult{\n\t\t\tExitCode:  ps.ExitCode,\n\t\t\tSignal:    ps.Signal,\n\t\t\tOOMKilled: ps.OOMKilled,\n\t\t}\n\t}\n\n\tselect {\n\tcase <-ctx.Done():\n\tcase <-d.ctx.Done():","sourceCodeStart":817,"sourceCodeEnd":853,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/drivers/qemu/driver.go#L817-L853","documentation":"handleWait wraps any error from the executor's Wait call into the task's ExitResult.Err. It indicates the executor plugin failed while waiting on the QEMU process, not that QEMU itself exited with a bad code.","triggerScenarios":"handle.exec.Wait(ctx) returns an error — e.g. the executor plugin crashed, the context was cancelled mid-wait, or IPC with the executor broke.","commonSituations":"Nomad client shutting down and cancelling wait contexts; executor plugin process killed; plugin client connection dropped mid-task.","solutions":["Read the wrapped %v error in the ExitResult / alloc task events for the root cause","If ExitCode is -1 with process state nil, the task was likely killed externally — check host logs (OOM killer, SIGKILL)","Restart the task/alloc; if the executor plugin is repeatedly failing, restart the Nomad client"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"// Go: inspect ExitResult to distinguish killed vs failed wait\nif res.ExitCode == -1 && res.Err != nil && strings.Contains(res.Err.Error(), \"error waiting on process\") {\n    // executor wait failed, not a normal exit\n}","tryCatchPattern":"res, err := ch.recv(ctx) // ExitResult channel from handleWait\nif err != nil || (res != nil && res.Err != nil) {\n    log.Printf(\"task wait failed: %v\", res.Err)\n}","preventionTips":["Monitor Nomad client/executor process health","Check for OOM killer or external SIGKILL on QEMU processes","Restart allocs cleanly after client restarts"],"tags":["qemu","executor","wait","process-exit","nomad-driver"],"backgroundTag":"process-wait-failed","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}