The AbstractPollTask._unregister_if_appropriate method calls self.wait() before the process exit status has become available, which for subclasses of SubProcess will ultimately triggering recursion in the SubProcess._waitpid_loop method. This is only a problem for EbuildMetadataPhase, since it's the only subclass of SubProcess that calls _unregister_if_appropriate.
The bug has been referenced in the following commit(s):
Author: Zac Medico <firstname.lastname@example.org>
AuthorDate: 2018-04-22 18:16:55 +0000
Commit: Zac Medico <email@example.com>
CommitDate: 2018-04-22 18:16:55 +0000
SubProcess: fix _unregister_if_appropriate event loop recursion (bug 614104)
Override the AbstractPollTask._unregister_if_appropriate method to avoid
event loop recursion when the pid exit status is not yet available, by
calling self._async_waitpid() instead of self.wait(). Also make
_async_waitpid fallback to _async_wait if the pid exit status happens to
be available already.
pym/_emerge/SubProcess.py | 20 +++++++++++++++++++-
1 file changed, 19 insertions(+), 1 deletion(-)}
Fixed in portage-2.3.40-r1.