Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 614104

Summary: AbstractPollTask._unregister_if_appropriate triggers event loop recursion
Product: Portage Development Reporter: Zac Medico <zmedico>
Component: Core - Interface (emerge)Assignee: Portage team <dev-portage>
Status: RESOLVED FIXED    
Severity: normal Keywords: InVCS
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: All   
See Also: https://bugs.gentoo.org/show_bug.cgi?id=613990
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 591760, 651804    

Description Zac Medico gentoo-dev 2017-03-28 03:48:35 UTC
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.
Comment 1 Larry the Git Cow gentoo-dev 2018-04-22 18:26:00 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=c5ab0696cec1f0f020d2d8ad416f9b1444a467de

commit c5ab0696cec1f0f020d2d8ad416f9b1444a467de
Author:     Zac Medico <zmedico@gentoo.org>
AuthorDate: 2018-04-22 18:16:55 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
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.
    
    Bug: https://bugs.gentoo.org/614104

 pym/_emerge/SubProcess.py | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)}
Comment 2 Zac Medico gentoo-dev 2018-07-02 18:40:10 UTC
Fixed in portage-2.3.40-r1.