There are some potential edge cases where "forkserver"
can result in threads being started before fork()
:
- Python has an API,
ForkServer.set_forkserver_preload()
, to add modules to import in the parent process that getsfork()ed
for workers; I’ve seen people recommend this specifically for large scientific computing/numeric libraries. It’s not documented in the Python documentation though, perhaps it could just be deprecated too. -
__main__
is always preloaded by default, for some definition of__main__
. I am not certain whether or not this is a problem; it’s a bunch of code and I don’t really understand what it’s doing at first glance (there’s even a one-off hack to handle an ipython bug from 2013!). - Code that runs via .pth files; I do this for the Python profiler I’m working on, I believe
manhole
does this. This is fairly rare I suspect. My profiler does make an effort to handlefork()
withoutexecve()
.