From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: <gentoo-commits+bounces-1150748-garchives=archives.gentoo.org@lists.gentoo.org> 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 06827138350 for <garchives@archives.gentoo.org>; Sat, 7 Mar 2020 22:18:15 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id 311F9E086C; Sat, 7 Mar 2020 22:18:14 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 0F058E086C for <gentoo-commits@lists.gentoo.org>; Sat, 7 Mar 2020 22:18:14 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 616AA34F1B9 for <gentoo-commits@lists.gentoo.org>; Sat, 7 Mar 2020 22:18:12 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id DB5BE103 for <gentoo-commits@lists.gentoo.org>; Sat, 7 Mar 2020 22:18:09 +0000 (UTC) From: "Zac Medico" <zmedico@gentoo.org> 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" <zmedico@gentoo.org> Message-ID: <1583618482.8cc84cea654238676f7edc04b9c75c001535c0b4.zmedico@gentoo> Subject: [gentoo-commits] proj/portage:master commit in: lib/_emerge/ X-VCS-Repository: proj/portage X-VCS-Files: lib/_emerge/CompositeTask.py lib/_emerge/SequentialTaskQueue.py X-VCS-Directories: lib/_emerge/ X-VCS-Committer: zmedico X-VCS-Committer-Name: Zac Medico X-VCS-Revision: 8cc84cea654238676f7edc04b9c75c001535c0b4 X-VCS-Branch: master Date: Sat, 7 Mar 2020 22:18:09 +0000 (UTC) Precedence: bulk List-Post: <mailto:gentoo-commits@lists.gentoo.org> List-Help: <mailto:gentoo-commits+help@lists.gentoo.org> List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org> List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org> List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org> X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: ec7a58c3-ab82-4531-9052-6b85efe4db86 X-Archives-Hash: 25eb1f4400566a17f336f8f093c8081c commit: 8cc84cea654238676f7edc04b9c75c001535c0b4 Author: Zac Medico <zmedico <AT> gentoo <DOT> org> AuthorDate: Sat Mar 7 21:52:53 2020 +0000 Commit: Zac Medico <zmedico <AT> gentoo <DOT> org> CommitDate: Sat Mar 7 22:01:22 2020 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=8cc84cea SequentialTaskQueue: cancel unstarted tasks when appropriate (bug 711322) When the clear method is called, cancel any tasks which have not started yet, in order to ensure that their start/exit listeners are called. This fixes a case where emerge would hang after SIGINT. Also fix the CompositeTask _cancel method to react appropriately to the cancel event when the task has not started yet. Bug: https://bugs.gentoo.org/711322 Signed-off-by: Zac Medico <zmedico <AT> gentoo.org> lib/_emerge/CompositeTask.py | 4 ++++ lib/_emerge/SequentialTaskQueue.py | 3 +++ 2 files changed, 7 insertions(+) diff --git a/lib/_emerge/CompositeTask.py b/lib/_emerge/CompositeTask.py index 1d199d19b..2ad1d783d 100644 --- a/lib/_emerge/CompositeTask.py +++ b/lib/_emerge/CompositeTask.py @@ -20,6 +20,10 @@ class CompositeTask(AsynchronousTask): self._async_wait() else: self._current_task.cancel() + elif self.returncode is None: + # Assume that the task has not started yet. + self._was_cancelled() + self._async_wait() def _poll(self): """ diff --git a/lib/_emerge/SequentialTaskQueue.py b/lib/_emerge/SequentialTaskQueue.py index 318bd6c55..38ebb98d8 100644 --- a/lib/_emerge/SequentialTaskQueue.py +++ b/lib/_emerge/SequentialTaskQueue.py @@ -74,7 +74,10 @@ class SequentialTaskQueue(SlotObject): """ Clear the task queue and asynchronously terminate any running tasks. """ + for task in self._task_queue: + task.cancel() self._task_queue.clear() + for task in list(self.running_tasks): task.cancel()