ID 518942 - multiprocessing Python module doesn't work in Nuke, causing Nuke to hang indefinitely or the command to not run correctly

Follow

Problem summary
multiprocessing Python module doesn't work in Nuke, causing Nuke to hang indefinitely or the command to not run correctly
 
Windows and macOS seem to hang, while Linux runs the command, however it fails to print everything to the Script Editor
 
Customer reported version
nuke.13.2v2
 
Customer reported platform
windows10
 
Steps to reproduce
 
1) Open Nuke

2) In the Script Editor, run the following code:
 

from multiprocessing import Process, Pipedef f(conn, name):    test = []    for i in range(10):        import time        print(i)        test.append(str(i) + "-" + name)        time.sleep(.5)    conn.send(test)    conn.close()if __name__ == '__main__':    parent_conn, child_conn = Pipe()    p = Process(target=f, args=(child_conn, 'test',))    p.start()    print("waiting")    print(parent_conn.recv()) 
 
Expected behaviour
For the Script Editor to print waiting then the numbers 0-9, with a 0.5 second gap, then a list of all the numbers with - "test" appended, same as if you were to use regular Python:


 
 
Actual behaviour
On Windows and macOS, Nuke hangs indefinitely with no crash report. In the Command Prompt it also errors saying: 
 
Unknown units in -c from multiprocessing.spawn import spawn_main; spawn_main(parent_pid
 

 
On Linux, Nuke hangs for a few seconds, then prints just waiting and the final list, not the other numbers. Nothing is printed to the Terminal:
 

 
Workaround
None
 
Reproduced by support
This bug has been reproduced in:
Nuke 13.2v4 - Windows 10, CentOS 7, macOS 12.5
Nuke 12.0v1 - Windows 10
Nuke 9.0v1 - Windows 10
 
Earliest version tested
Nuke 9.0v1 - This issue doesn't appear in this version and has regressed
 
 

    We're sorry to hear that

    Please tell us why