Hello @Jigar ,
Thank you for sharing the details of your process launcher design and clearly outlining the guarantees you are looking for.
I spent some time reviewing your questions and checking the available Microsoft documentation. Here is what I found:
- According to the UpdateProcThreadAttribute documentation,
PROC_THREAD_ATTRIBUTE_JOB_LISTlets you specify the Job Objects to which a new process should be assigned during creation, in the order provided. This is the supported mechanism for creation-time Job Object assignment, rather than assigning the process separately afterward. - The CreateProcessW documentation explains that the function returns zero on failure, with
GetLastErrorproviding additional error information. This helps identify creation failures, although the return value alone does not establish whether a surviving child process is possible after a Job Object assignment failure. - As explained in this article, Job Object assignment through
PROC_THREAD_ATTRIBUTE_JOB_LISThappens before the process's initial thread is allowed to run. The Process Creation Flags documentation also confirms thatCREATE_SUSPENDEDkeeps the primary thread suspended until it is resumed. - For interrupted process creation, the available documentation describes the creation-time assignment mechanism, while the specific atomic rollback or cleanup behavior during an interruption would require further clarification.
- The Job Objects documentation confirms that
JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSEterminates processes already associated with the job when its last handle is closed. Windows also automatically closes a process's handles when it terminates, as described in the Object Interface documentation. This means that if the creator holds the last job handle, closing that handle triggers termination of the processes already associated with the job. If other job handles remain open, the last-handle condition has not yet been met. - As described in the Nested Jobs documentation, hierarchy restrictions and Job Object limits can affect process assignment. These rules are important when your launcher operates within an existing parent job or uses multiple Job Objects, since a valid hierarchy must be maintained.
These are the findings I could verify from Microsoft's public documentation. The specific fail-closed guarantees involving creator termination, failed creation, and interrupted assignment would still require further confirmation.
Since Microsoft Q&A is a community forum, my ability to investigate Windows implementation-level behavior is limited. Given how important these guarantees are to your design, I recommend contacting Windows Developer Support for a more detailed assessment. Technical support for Windows SDK requires a Microsoft support contract.
I hope this helps clarify the available information and gives you a useful direction. If you find my response helpful, you may also refer to this guide to help others find useful information on similar questions.
Thank you.