mirror of https://github.com/grpc/grpc.git
[Python Fork] Use os.register_at_fork instead of pthread_atfork. (#32935)
Fix: https://github.com/grpc/grpc/issues/18075 From comments in https://github.com/grpc/grpc/issues/18075, `CPython` reinitialize the `GIL` after `pthread_atfork` child handler, thus we shouldn't use any `GIL` related functions in child handler which is what we're currently doing, this PR uses `os.register_at_fork` to replace `pthread_atfork` to prevent any undesired bevahior. This also seems to fixes a thread hanging issue cased by changes in core: https://github.com/grpc/grpc/pull/32869 ### Testing: * Passed existing fork tests. (Note that due to some issues in `Bazel`, this change was not verified by `Bazel runs_per_test`). * Tested by patch the core PR, was able to fix Python fork tests: https://github.com/grpc/grpc/pull/32933pull/32939/head
parent
706352a86e
commit
bcb97011f4
2 changed files with 4 additions and 9 deletions
Loading…
Reference in new issue