Looks there is a race condition in pym/portage/dbapi/_MergeProcess.py on _spawn function: if child terminate before parent we'll get this stacktrace: Traceback (most recent call last): File "/usr/bin/emerge", line 50, in <module> retval = emerge_main() File "/usr/lib64/portage/pym/_emerge/main.py", line 1031, in emerge_main return run_action(emerge_config) File "/usr/lib64/portage/pym/_emerge/actions.py", line 4062, in run_action emerge_config.args, spinner) File "/usr/lib64/portage/pym/_emerge/actions.py", line 453, in action_build retval = mergetask.merge() File "/usr/lib64/portage/pym/_emerge/Scheduler.py", line 1019, in merge rval = self._merge() File "/usr/lib64/portage/pym/_emerge/Scheduler.py", line 1408, in _merge self._main_loop() File "/usr/lib64/portage/pym/_emerge/Scheduler.py", line 1385, in _main_loop self._event_loop.iteration() File "/usr/lib64/portage/pym/portage/util/_eventloop/EventLoop.py", line 268, in iteration if not x.callback(f, event, *x.args): File "/usr/lib64/portage/pym/portage/util/_async/PipeLogger.py", line 133, in _output_handler self._unregister_if_appropriate(event) File "/usr/lib64/portage/pym/_emerge/AbstractPollTask.py", line 129, in _unregister_if_appropriate self.wait() File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 57, in wait self._wait_hook() File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 175, in _wait_hook self._exit_listener_stack.pop()(self) File "/usr/lib64/portage/pym/_emerge/SpawnProcess.py", line 168, in _pipe_logger_exit self.wait() File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 57, in wait self._wait_hook() File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 175, in _wait_hook self._exit_listener_stack.pop()(self) File "/usr/lib64/portage/pym/_emerge/EbuildPhase.py", line 296, in _post_phase_exit self.wait() File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 57, in wait self._wait_hook() File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 175, in _wait_hook self._exit_listener_stack.pop()(self) File "/usr/lib64/portage/pym/_emerge/TaskSequence.py", line 43, in _task_exit_handler self.wait() File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 57, in wait self._wait_hook() File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 175, in _wait_hook self._exit_listener_stack.pop()(self) File "/usr/lib64/portage/pym/_emerge/CompositeTask.py", line 134, in _default_final_exit return self.wait() File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 57, in wait self._wait_hook() File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 175, in _wait_hook self._exit_listener_stack.pop()(self) File "/usr/lib64/portage/pym/_emerge/EbuildBuild.py", line 302, in _build_exit self.wait() File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 57, in wait self._wait_hook() File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 175, in _wait_hook self._exit_listener_stack.pop()(self) File "/usr/lib64/portage/pym/_emerge/CompositeTask.py", line 134, in _default_final_exit return self.wait() File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 57, in wait self._wait_hook() File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 175, in _wait_hook self._exit_listener_stack.pop()(self) File "/usr/lib64/portage/pym/_emerge/Scheduler.py", line 1330, in _build_exit self._task_queues.merge.add(merge) File "/usr/lib64/portage/pym/_emerge/SequentialTaskQueue.py", line 23, in add self.schedule() File "/usr/lib64/portage/pym/_emerge/SequentialTaskQueue.py", line 45, in schedule task.start() File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 30, in start self._start() File "/usr/lib64/portage/pym/_emerge/PackageMerge.py", line 43, in _start self._start_task(task, self._default_final_exit) File "/usr/lib64/portage/pym/_emerge/CompositeTask.py", line 151, in _start_task task.start() File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 30, in start self._start() File "/usr/lib64/portage/pym/_emerge/EbuildMerge.py", line 34, in _start self._start_task(merge_task, self._merge_exit) File "/usr/lib64/portage/pym/_emerge/CompositeTask.py", line 151, in _start_task task.start() File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 30, in start self._start() File "/usr/lib64/portage/pym/portage/dbapi/_MergeProcess.py", line 60, in _start super(MergeProcess, self)._start() File "/usr/lib64/portage/pym/_emerge/SpawnProcess.py", line 140, in _start self._pipe_logger.start() File "/usr/lib64/portage/pym/_emerge/AsynchronousTask.py", line 30, in start self._start() File "/usr/lib64/portage/pym/portage/util/_async/PipeLogger.py", line 32, in _start encoding=_encodings['fs'], errors='strict'), mode='ab') IOError: [Errno 2] No such file or directory: '/var/tmp/portage/net-analyzer/netcat-110-r9/temp/build.log' Reproducible: Always Steps to Reproduce: 1. Place the "import time; time.sleep(10)" code in the parent(just after if pid != 0) 2. Try to emerge any package Actual Results: Exception Expected Results: All is ok