CreateProcessW + JOB_LIST: child lifetime if the caller terminates before the API returns
I am seeking clarification of the supported Windows API contract for one process-lifetime scenario. No orphaned process has been observed or reproduced; this is a documentation question.
Assume the following valid setup:
- A user-mode caller creates an unnamed, private Job Object and successfully enables JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE through JOBOBJECT_EXTENDED_LIMIT_INFORMATION.
- The caller owns the only user-mode handle to that job. The handle is not inheritable and is never duplicated or passed to another process.
- The caller supplies that job through PROC_THREAD_ATTRIBUTE_JOB_LIST in a valid STARTUPINFOEX and calls CreateProcessW with EXTENDED_STARTUPINFO_PRESENT and CREATE_SUSPENDED. No breakaway is requested or permitted. All other parameters, permissions and any applicable job-nesting constraints are valid.
- The entire calling process is abruptly terminated while CreateProcessW is still in progress, before it returns. The caller therefore cannot inspect PROCESS_INFORMATION, close returned handles, resume the child, or perform any post-call cleanup. This is process termination, not merely a terminated thread, a hung caller, or an operating-system crash.
Does Windows provide a supported guarantee that this interrupted operation cannot leave a child process alive outside the effective protection of the job, including a suspended child with no surviving supervisor?
For this single guarantee, please clarify: A. Whether any child execution can occur outside the required job association in this interrupted call. B. Whether a partially created, unassigned or otherwise unprotected suspended child can remain after the caller has terminated. C. How job association and closure of the caller's last job handle are ordered for this case, including the effect of any internal references acquired during creation. D. Whether the child is either effectively covered by job termination or creation is unwound, without requiring CreateProcessW to return to the caller.
The documentation describes job-list assignment during creation and termination of associated processes on last-handle closure. I have not established how those rules jointly settle the exact interruption-before-return case:
- https://learn.microsoft.com/en-us/windows/win32/api/processthreadsapi/nf-processthreadsapi-updateprocthreadattribute
- https://devblogs.microsoft.com/oldnewthing/20230209-00/?p=107812
- https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-jobobject_basic_limit_information
Please identify the documented contract or an authoritative Windows API clarification, including applicable Windows versions and conditions. If this exact outcome is unspecified or not guaranteed, please state that boundary explicitly. An explanation of the ordinary successful return path alone would not resolve this question. No fixed cleanup-time guarantee or review of application code is being requested.