* [gentoo-portage-dev] [PATCH] Scheduler._terminate_tasks: purge _running_tasks (bug 425554)
@ 2016-08-20 18:49 Zac Medico
2016-08-22 10:14 ` Alexander Berntsen
0 siblings, 1 reply; 3+ messages in thread
From: Zac Medico @ 2016-08-20 18:49 UTC (permalink / raw
To: gentoo-portage-dev
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
---
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()
--
2.7.4
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [gentoo-portage-dev] [PATCH] Scheduler._terminate_tasks: purge _running_tasks (bug 425554)
2016-08-20 18:49 [gentoo-portage-dev] [PATCH] Scheduler._terminate_tasks: purge _running_tasks (bug 425554) Zac Medico
@ 2016-08-22 10:14 ` Alexander Berntsen
2016-08-22 16:10 ` Zac Medico
0 siblings, 1 reply; 3+ messages in thread
From: Alexander Berntsen @ 2016-08-22 10:14 UTC (permalink / raw
To: gentoo-portage-dev
[-- Attachment #1.1: Type: text/plain, Size: 119 bytes --]
Woah. I remember this bug. Nice. LGTM.
--
Alexander
bernalex@gentoo.org
https://secure.plaimi.net/~alexander
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [gentoo-portage-dev] [PATCH] Scheduler._terminate_tasks: purge _running_tasks (bug 425554)
2016-08-22 10:14 ` Alexander Berntsen
@ 2016-08-22 16:10 ` Zac Medico
0 siblings, 0 replies; 3+ messages in thread
From: Zac Medico @ 2016-08-22 16:10 UTC (permalink / raw
To: gentoo-portage-dev
On 08/22/2016 03:14 AM, Alexander Berntsen wrote:
> Woah. I remember this bug. Nice. LGTM.
>
Pushed:
https://gitweb.gentoo.org/proj/portage.git/commit/?id=d54a795615ccb769a25a0f8d6cc15ba930ec428f
--
Thanks,
Zac
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-08-22 16:10 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-08-20 18:49 [gentoo-portage-dev] [PATCH] Scheduler._terminate_tasks: purge _running_tasks (bug 425554) Zac Medico
2016-08-22 10:14 ` Alexander Berntsen
2016-08-22 16:10 ` Zac Medico
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox