Windows 11: Job Object inheritance when the creator terminates inside CreateProcessW

Peter Geyer 20 Reputation points
2026-11-19T06:15:41.6566667+00:00

We are reviewing the supported Win32 process lifecycle guarantees for the following scenario.

A trusted process S is already a verified member of an outer Job Object J_G before it is permitted to create untrusted child processes.

J_G has JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE enabled. Breakaway is not permitted. During active child creation, an independent controller R holds the only remaining open handle to J_G.

S calls CreateProcessW with CREATE_SUSPENDED, AppContainer security attributes, and optionally PROC_THREAD_ATTRIBUTE_JOB_LIST for additional inner jobs.

The entire S process terminates unexpectedly before CreateProcessW returns.

We would appreciate clarification of the supported Windows contract:

Q1. Is every surviving child process, including a suspended or partially created child, guaranteed to be a member of the inherited outer Job Object J_G? If not, which outcomes are permitted?

Q2. Does this guarantee remain valid if R concurrently calls TerminateJobObject or closes the last handle to J_G? Can an in-flight child creation complete afterward without being controlled by J_G?

Q3. Does termination and signaling of S establish a supported completion boundary for all child creation operations previously initiated by S? If not, is there another documented mechanism to establish that boundary?

Q4. Is there a supported mechanism to independently verify the required Job Object membership while preserving exclusive outer-job handle ownership during active child creation?

We are familiar with the documented behavior of nested jobs, PROC_THREAD_ATTRIBUTE_JOB_LIST, and JOB_OBJECT_LIMIT_KILL_ON_JOB_CLOSE.

Our question specifically concerns interrupted native process creation and concurrent Job Object termination.

We would appreciate a distinction between documented API guarantees, implementation-specific behavior, and empirical observations, together with applicable Windows version or build constraints.

If these guarantees are not publicly specified, please advise whether a Microsoft engineering support channel can clarify the supported contract.

Thank you.

Windows development | Windows API - Win32
0 comments No comments

1 answer

Sort by: Most helpful
  1. Zack Nguyen (WICLOUD CORPORATION) 405 Reputation points Microsoft External Staff Moderator
    2026-11-19T06:50:59.9333333+00:00

    Hi @Peter Geyer ,

    After reviewing on your questions and the available Microsoft documentations, here are my answers:

    The Win32 Job Objects documentation specifies normal job inheritance and termination of associated processes. It does not specify what happens to a partially created child if S dies inside CreateProcessW, or how that creation is ordered against concurrent job teardown.

    1. Must every surviving child belong to J_G? For ordinary CreateProcessW creation with no breakaway, the child inherits the parent’s job. CREATE_SUSPENDED keeps the primary thread from running until resumed; it does not guarantee rollback. The public references neither enumerate the possible outcomes of an interrupted call nor establish that an unassigned child can survive.

    2. What if R tears down the job concurrently? TerminateJobObject covers processes currently associated with the job and its child jobs. Closing the last handle with KILL_ON_JOB_CLOSE also terminates associated processes, including suspended members. Neither reference specifies how teardown is ordered against an association still in flight, so the docs neither establish nor rule out a late, uncontained child in this scenario.

    3. Is waiting for S enough? Waiting on S’s process handle confirms that S terminated, not that every child creation it initiated completed or rolled back. I found no documented Win32 wait that provides that broader guarantee after abrupt creator termination.

    4. Can R verify membership without sharing the job handle? Yes, for a known child. R can call IsProcessInJob using its existing JOB_OBJECT_QUERY handle and a query-capable child process handle. Passing NULL checks membership in any job, not specifically J_G. R can also list the job’s member PIDs, including nested members, but that list cannot account for an unknown child outside the job.


    Because the public documentation does not define how interrupted process creation interacts with concurrent job termination, I recommend opening a case with Microsoft Support for Business. They can advise whether the question can be routed to Windows engineering for clarification. Please note that this is a paid support option.

    I hope this helps clarifying your requirements and answering your questions. If you find my response helpful, I would greatly appreciate it if you could follow the guide here so others experiencing similar behavior can benefit from it as well.

    Was this answer helpful?


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.