This hangs, but when running GOGC=off python test.py it works fine. Actually, calling runtime.GC() directly in the library causes a hang, suggesting that the garbage collector is responsible for hanging. Note that when using multiprocessing with Python, library function calls are put on a different thread from the one that initialized the Go package (init()).
What is causing the GC to hang? How can this be debugged?
The text was updated successfully, but these errors were encountered:
This seems to be an issue with forking a Go thread. Since Go launches an additional thread for the GC, when forking the main thread the other GC thread is not forked as well, causing it to hang when a forked thread tries to reach the GC thread of the original process. The solution is to not fork Go, but use the spawn strategy for example.