The goal of this change is to avoid calling pthread_atfork() handlers. Some libraries, in particular the version of OpenBLAS included in NumPy, have buggy pthread_atfork() handlers. See https://github.com/xianyi/OpenBLAS/pull/3111 and https://github.com/google/jax/issues/5713 for details.
Now, while we can and have fixed the buggy atfork handlers, it will take some time for the fix to be deployed in a NumPy release and for users to update to a new NumPy release. So we also take an additional step: avoid running atfork handlers in Subprocess.
My copy of the glibc documentation says:
"
According to POSIX, it unspecified whether fork handlers established with pthread_atfork(3)
are called when posix_spawn() is invoked. On glibc, fork handlers are called only if the
child is created using fork(2).
"
It appears glibc 2.24 and newer do not call pthread_atfork() handlers from posix_spawn().
Using posix_spawn() should be at least no worse than an explicit fork()/execvp() pair, and on glibc it should do the right thing.
PiperOrigin-RevId: 358317859
Change-Id: Ic1d95446706efa7c0db4e79bf8281f14b2bd99df
This package contains the following libraries:
- Platform dependent libraries that require different implementations
across different OSs or environments.
- STL replacement libraries rest of TensorFlow should depend on.
The libraries in this package are not allowed to have ANY dependencies
to any TensorFlow code outside this package.