{"record":{"id":"80c08c4f0a1d5e97","repo":"argoproj/argo-workflows","slug":"failed-to-load-ctrlroutine-w","errorCode":null,"errorMessage":"failed to load CtrlRoutine: %w","messagePattern":"failed to load CtrlRoutine: %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"workflow/executor/osspecific/signal_windows.go","lineNumber":76,"sourceCode":"\treturn err\n}\n\n// signalProcess sends the specified signal to a process.\n//\n// Code +/- copied from: https://github.com/microsoft/hcsshim/blob/1d69a9c658655b77dd4e5275bff99caad6b38416/internal/jobcontainers/process.go#L251\n// License: MIT\n// Author: Microsoft\nfunc signalProcess(pid uint32, signal int) error {\n\thProc, err := windows.OpenProcess(windows.PROCESS_TERMINATE, true, pid)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to open process: %w\", err)\n\t}\n\tdefer func() {\n\t\t_ = windows.Close(hProc)\n\t}()\n\n\tif err := procCtrlRoutine.Find(); err != nil {\n\t\treturn fmt.Errorf(\"failed to load CtrlRoutine: %w\", err)\n\t}\n\n\tthreadHandle, err := createRemoteThread(hProc, nil, 0, procCtrlRoutine.Addr(), uintptr(signal), 0, nil)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to open remote thread in target process %d: %w\", pid, err)\n\t}\n\tdefer func() {\n\t\t_ = windows.Close(windows.Handle(threadHandle))\n\t}()\n\treturn nil\n}\n\n// Following code has been generated using github.com/Microsoft/go-winio/tools/mkwinsyscall and inlined\n// for easier usage\n\n// HANDLE CreateRemoteThread(\n//\n//\tHANDLE                 hProcess,","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/argoproj/argo-workflows/blob/35bff19146f5a6ada77468c431f2624bd577e373/workflow/executor/osspecific/signal_windows.go#L58-L94","documentation":"After opening the target process on Windows, signalProcess must locate the CtrlRoutine (the console control-handler entry point in kernelbase.dll) inside the remote process so it can inject a thread that delivers the signal. procCtrlRoutine.Find() failed, so the Windows signal cannot be delivered via remote thread.","triggerScenarios":"Kill() → signalProcess() on Windows when the CtrlRoutine address cannot be resolved in the target process — module snapshot/enumeration failure, kernelbase.dll not loaded in the target, or incompatible Windows version where the export layout differs.","commonSituations":"Targets running in job containers where module enumeration of the remote process is restricted; Windows version mismatch between the resolving code's assumptions and the target OS build; hardened/protected processes refusing cross-process module inspection.","solutions":["Verify the Windows version supports the CtrlRoutine lookup used by this hcsshim-derived code (upgrade host/OS image if very old)","Check that the target is a normal console process with kernelbase.dll loaded, not a PPL/protected process","Inspect argoexec logs for the wrapped cause; if module enumeration is blocked by container isolation, run with adjusted container privileges","As a fallback, terminate the process group via job-object termination instead of remote-thread signaling"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"// verify target module enumeration is possible before signaling\nif h, err := windows.OpenProcess(windows.PROCESS_QUERY_INFORMATION|windows.PROCESS_TERMINATE, true, pid); err != nil {\n    return err\n} else { windows.Close(h) }","typeGuard":null,"tryCatchPattern":"if err := osspecific.Kill(pid); err != nil && strings.Contains(err.Error(), \"failed to load CtrlRoutine\") {\n    // fall back to hard termination (job-object/TerminateProcess)\n}","preventionTips":["Ensure the target process is a normal console process with kernelbase.dll loaded","Match host Windows build with versions the CtrlRoutine lookup supports","Avoid protected/PPL targets in job containers","Log the wrapped cause to identify module-enumeration failures"],"tags":["windows","signals","process","executor"],"backgroundTag":"ctrl-routine-lookup-failed","analyzedSha":"35bff19146f5a6ada77468c431f2624bd577e373","analyzedAt":"2026-09-03T19:34:35.908Z","contentChangedAt":"2026-09-03T19:34:35.908Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}