Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 613990 - sys-apps/portage: SpawnProcess._pipe_logger_exit triggers event loop recursion
Summary: sys-apps/portage: SpawnProcess._pipe_logger_exit triggers event loop recursion
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Core - Interface (emerge) (show other bugs)
Hardware: All All
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks: 591760 619102
  Show dependency tree
 
Reported: 2017-03-27 06:28 UTC by Zac Medico
Modified: 2017-08-11 19:48 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Zac Medico gentoo-dev 2017-03-27 06:28:21 UTC
When testing a patch for bug 591760 that mimics asyncio behavior by raising "RuntimeError: This event loop is already running" when event loop recursion occurs, I found this case:

  File "pym/_emerge/SpawnProcess.py", line 174, in _pipe_logger_exit
    self.wait()
  File "pym/_emerge/AsynchronousTask.py", line 54, in wait
    self._wait()
  File "pym/_emerge/SubProcess.py", line 100, in _wait
    self._waitpid_loop()
  File "pym/_emerge/SpawnProcess.py", line 177, in _waitpid_loop
    SubProcess._waitpid_loop(self)
  File "pym/_emerge/SubProcess.py", line 109, in _waitpid_loop
    self.scheduler.iteration()
  File "pym/portage/util/_eventloop/EventLoop.py", line 240, in iteration
    raise RuntimeError("This event loop is already running")
RuntimeError: This event loop is already running

SpawnProcess._pipe_logger_exit method calls self.wait() before the process exit status has become available, ultimately triggering recursion in the SubProcess._waitpid_loop method. It's possible for this sort of recursion to cause the recursion depth limit to be exceeded, like in bug 402335. The solution is to make SpawnProcess._pipe_logger_exit use child_watch_add trigger an asynchronous call to self.wait().
Comment 3 Zac Medico gentoo-dev 2017-08-11 19:48:00 UTC
Fixed in 2.3.6.