From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id E618113832E for ; Mon, 22 Aug 2016 16:09:41 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 8A0F621C038; Mon, 22 Aug 2016 16:09:39 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 2A12221C038 for ; Mon, 22 Aug 2016 16:09:39 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id D40ED3407D0 for ; Mon, 22 Aug 2016 16:09:37 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id E66D02444 for ; Mon, 22 Aug 2016 16:09:35 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: <1471879883.d54a795615ccb769a25a0f8d6cc15ba930ec428f.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: pym/_emerge/ X-VCS-Repository: proj/portage X-VCS-Files: pym/_emerge/Scheduler.py X-VCS-Directories: pym/_emerge/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: d54a795615ccb769a25a0f8d6cc15ba930ec428f X-VCS-Branch: master Date: Mon, 22 Aug 2016 16:09:35 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: bdc31047-e123-41a5-99a5-13fba3071444 X-Archives-Hash: 80136405eef656f52be658f7a2cbd700 commit: d54a795615ccb769a25a0f8d6cc15ba930ec428f Author: Zac Medico gentoo org> AuthorDate: Sat Aug 20 13:06:38 2016 +0000 Commit: Zac Medico gentoo org> CommitDate: Mon Aug 22 15:31:23 2016 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=d54a7956 Scheduler._terminate_tasks: purge _running_tasks (bug 425554) Fix the _terminate_tasks method to purge unstarted tasks from self._running_tasks, so that they don't keep the main loop running indefinitely. X-Gentoo-bug: 425554 X-Gentoo-bug-url: https://bugs.gentoo.org/show_bug.cgi?id=425554 Acked-by: Alexander Berntsen gentoo.org> pym/_emerge/Scheduler.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/pym/_emerge/Scheduler.py b/pym/_emerge/Scheduler.py index 97b826a..71fe75f 100644 --- a/pym/_emerge/Scheduler.py +++ b/pym/_emerge/Scheduler.py @@ -328,7 +328,20 @@ class Scheduler(PollScheduler): def _terminate_tasks(self): self._status_display.quiet = True for task in list(self._running_tasks.values()): - task.cancel() + if task.isAlive(): + # This task should keep the main loop running until + # it has had an opportunity to clean up after itself. + # Rely on its exit hook to remove it from + # self._running_tasks when it has finished cleaning up. + task.cancel() + else: + # This task has been waiting to be started in one of + # self._task_queues which are all cleared below. It + # will never be started, so purged it from + # self._running_tasks so that it won't keep the main + # loop running. + del self._running_tasks[id(task)] + for q in self._task_queues.values(): q.clear()