From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from pigeon.gentoo.org ([208.92.234.80] helo=lists.gentoo.org) by finch.gentoo.org with esmtp (Exim 4.60) (envelope-from ) id 1Pxt3S-000620-Pq for garchives@archives.gentoo.org; Fri, 11 Mar 2011 03:30:19 +0000 Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 6739FE05BE; Fri, 11 Mar 2011 03:30:11 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) by pigeon.gentoo.org (Postfix) with ESMTP id 34B04E05F1 for ; Fri, 11 Mar 2011 03:30:11 +0000 (UTC) Received: from pelican.gentoo.org (unknown [66.219.59.40]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 894BE1B4028 for ; Fri, 11 Mar 2011 03:30:10 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by pelican.gentoo.org (Postfix) with ESMTP id E44C38006A for ; Fri, 11 Mar 2011 03:30:09 +0000 (UTC) From: "Zac Medico" To: gentoo-commits@lists.gentoo.org Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Zac Medico" Message-ID: 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: c051b01974fbfb1471b3fc60f8152cbec0b3034f Date: Fri, 11 Mar 2011 03:30:09 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: quoted-printable X-Archives-Salt: X-Archives-Hash: b9b82ce35d0cfeea5a13c4a73be9c89f commit: c051b01974fbfb1471b3fc60f8152cbec0b3034f Author: Zac Medico gentoo org> AuthorDate: Fri Mar 11 03:29:57 2011 +0000 Commit: Zac Medico gentoo org> CommitDate: Fri Mar 11 03:29:57 2011 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=3Dproj/portage.git;a= =3Dcommit;h=3Dc051b019 Scheduler: avoid infinite loop after CTRL-C If CTRL-C was received at certain times, it was possible for discarded tasks to be erroneously left in Scheduler._running_tasks, which would cause the main loop to run infinitely. Thanks to David James google.com> for reporting this issue and helping to devi= se a solution. --- pym/_emerge/Scheduler.py | 15 ++++++++++++++- 1 files changed, 14 insertions(+), 1 deletions(-) diff --git a/pym/_emerge/Scheduler.py b/pym/_emerge/Scheduler.py index aaa05d1..9f72856 100644 --- a/pym/_emerge/Scheduler.py +++ b/pym/_emerge/Scheduler.py @@ -295,6 +295,13 @@ class Scheduler(PollScheduler): =20 def _terminate_tasks(self): self._status_display.quiet =3D True + # Remove running_tasks that have been added to queues but + # haven't been started yet, since we're going to discard + # them and their start/exit handlers won't be called. + for build in self._task_queues.jobs._task_queue: + self._running_tasks.remove(build.pkg) + for merge in self._task_queues.merge._task_queue: + self._running_tasks.remove(merge.merge.pkg) for q in self._task_queues.values(): q.clear() =20 @@ -1471,7 +1478,13 @@ class Scheduler(PollScheduler): mtimedb.commit() =20 def _build_exit(self, build): - if build.returncode =3D=3D os.EX_OK: + if build.returncode =3D=3D os.EX_OK and self._terminated.is_set(): + # We've been interrupted, so we won't + # add this to the merge queue. + self.curval +=3D 1 + self._running_tasks.remove(build.pkg) + self._deallocate_config(build.settings) + elif build.returncode =3D=3D os.EX_OK: self.curval +=3D 1 merge =3D PackageMerge(merge=3Dbuild) if not build.build_opts.buildpkgonly and \