Thank you for your respond.
That was our model too about reality. But something changed. These are pretty old parts of our program.
The created process does a lot of work for the app worker thread before that thread returns. Worker thread and the background process communicate with each other using memory mapped file and two mutexes (no initial owner, security attributes NULL). It worked for ages, but some weeks ago something changed, there were VS2019 and Win10 updates.
Sharing the code is difficult because it is large and embedded in the deep.
Meanwhile I implemented the helper thread pattern. The helper thread creates the process (and waits for the quit signal), other worker threads feed the process with jobs through the mmf/mutexes. And when the main app wants to quit, it signals the helper thread what returns, and the background process terminates. Everything works as expected.
But so far, the original pattern was working too.
Is it possible somehow that a created HANDLE (CreateProcess()) life cycle is connected to its creator thread? And the thread returns, those handles close too and that terminates the process.