The fork() calls in multithreaded SUA applications can result in unpredictable behavior
Assume a multithreaded application containing threads “A” and “B” such that “A” is calling fork and at the same time “B” has acquired NTDLL heap lock. The child process is created. The NTDLL heap lock is marked as acquired by thread “B”. There is no thread “B” in the child. The main thread in the child while coming up tries to take the NTDLL heap lock, and because of the library’s locked state, the process stops responding.
This issue is valid for both mixed-mode and Subsystem for UNIX-based Applications programs.
Warning: Microsoft strongly discourages using fork() calls in multithreaded Subsystem for UNIX-based Applications (SUA) .
For more information on this issue, including potential causes, workarounds, and resolutions, see: Microsoft KB Article KB2019947.