Created attachment 1042 [details] example code from description Attached is a sample program that I believe should work, but doesn't. The program is a simple command runner. It runs a maximum of 4 processes at once and each process is just "echo <number>". The command runner uses "spawn" to create a new thread. This thread then immediately forks and calls execv in the child. The parent then waits on the newly created process. When it finishes, it sends it's tid and the exit status of the command. When run, sometimes a thread will seem to stall on the execv call. It seems that the fork happened successfully, but a quick check with "ps" will reveal that two processes named "test" exist (the forked one should have been replaced). The program then has no way to continue by itself. The only way to make it continue is to call "kill" on the newly created processes.
You allocate in a forked process. Try to use spawnProcess instead, it tries to avoid complex operations after fork.
You are mixing threads with forking. This is a bad idea in any language. What happens is that a thread from the main process forks, but it doesn't take along with it the other threads. One of those threads is running the GC, which holds a lock. As the GC thread is not duplicated during the fork, the lock will never be freed, thus the forked process will deadlock.