For platforms where multiprocessing.reduction.HAVE_SEND_HANDLE is true, ForkProcess should be able to support fd_pipes via multiprocessing.Pipe and send_handle/recv_handle.
The unix-only sendfds/recvfds functions might be better than send_handle/recv_handle. Either way, we'll need a helper class to manage sending the fd_pipes file descriptors to the child process asynchronously.
The bug has been referenced in the following commit(s): https://gitweb.gentoo.org/proj/portage.git/commit/?id=6abc969109754ab086db2bac5be1029de1a015c3 commit 6abc969109754ab086db2bac5be1029de1a015c3 Author: Zac Medico <zmedico@gentoo.org> AuthorDate: 2023-10-20 04:11:48 +0000 Commit: Zac Medico <zmedico@gentoo.org> CommitDate: 2023-10-22 04:17:48 +0000 ForkProcess: Implement fd_pipes via send_handle This new fd_pipes implementation is only enabled when the multiprocessing start method is not fork, ensuring backward compatibility with existing ForkProcess callers that rely on the fork start method. Note that the new fd_pipes implementation uses a thread via run_in_executor, and threads are not recommended for mixing with the fork start method due to cpython issue 84559. Bug: https://bugs.gentoo.org/915896 Signed-off-by: Zac Medico <zmedico@gentoo.org> lib/portage/tests/process/test_ForkProcess.py | 7 ++ lib/portage/util/_async/ForkProcess.py | 142 +++++++++++++++++++++----- 2 files changed, 124 insertions(+), 25 deletions(-)
The bug has been closed via the following commit(s): https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=2b9128b401def05cac46f9e6d66048e5a0d888b8 commit 2b9128b401def05cac46f9e6d66048e5a0d888b8 Author: Sam James <sam@gentoo.org> AuthorDate: 2023-10-25 05:48:31 +0000 Commit: Sam James <sam@gentoo.org> CommitDate: 2023-10-25 05:48:40 +0000 sys-apps/portage: add 3.0.54 Closes: https://bugs.gentoo.org/905869 Closes: https://bugs.gentoo.org/915551 Closes: https://bugs.gentoo.org/915896 Closes: https://bugs.gentoo.org/916106 Closes: https://bugs.gentoo.org/916108 Closes: https://bugs.gentoo.org/916112 Closes: https://bugs.gentoo.org/916116 Closes: https://bugs.gentoo.org/916139 Closes: https://bugs.gentoo.org/916141 Closes: https://bugs.gentoo.org/916142 Closes: https://bugs.gentoo.org/916149 Closes: https://bugs.gentoo.org/916182 Closes: https://bugs.gentoo.org/916231 Closes: https://bugs.gentoo.org/916235 Closes: https://bugs.gentoo.org/916240 Closes: https://bugs.gentoo.org/916242 Closes: https://bugs.gentoo.org/916245 Closes: https://bugs.gentoo.org/916248 Closes: https://bugs.gentoo.org/899898 Closes: https://bugs.gentoo.org/906129 Closes: https://bugs.gentoo.org/906156 Closes: https://bugs.gentoo.org/916031 Signed-off-by: Sam James <sam@gentoo.org> sys-apps/portage/Manifest | 1 + sys-apps/portage/portage-3.0.54.ebuild | 238 +++++++++++++++++++++++++++++++++ 2 files changed, 239 insertions(+)