From patchwork Wed Jan 11 17:50:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 18025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id F2294C67871 for ; Wed, 11 Jan 2023 17:51:11 +0000 (UTC) Received: from mail-wr1-f47.google.com (mail-wr1-f47.google.com [209.85.221.47]) by mx.groups.io with SMTP id smtpd.web11.31181.1673459462210592362 for ; Wed, 11 Jan 2023 09:51:02 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=ZjUihHPY; spf=pass (domain: linuxfoundation.org, ip: 209.85.221.47, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wr1-f47.google.com with SMTP id d17so15864679wrs.2 for ; Wed, 11 Jan 2023 09:51:01 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=wSjAxRAQcksFAPSyh03+o7qUHlHIZkXm7wrlkoYL4yE=; b=ZjUihHPY6m/6l66f7ukWfmzDI5E03cnRWVnRLqGVbOyqK9jQHgoNaSZGJq9hpgthcU Yd+BLOITAUHAPPy34n4ytKRDCoR4PMNYVOL8XalhLuksOY3nCNnfBVcY+GgKRYlYKXBX yGVJdPw09TpYnXh3yGb1fSpYpHvnIJWVvBZ8M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=wSjAxRAQcksFAPSyh03+o7qUHlHIZkXm7wrlkoYL4yE=; b=sY4ZxMKEfTqR+4114wILeKoT6PneQpxOhPuD6EiAL6XuAxAYfMVnNR+mXeOEN4atge NMf029ja9jv9owpJHGADAecbRk5cw8C6gVKd1EFvIjoZLC+lOtgtxoHp85HkCKzNMsXZ HHrwMoesTlf0y54PqQ+0gEtzPj4Yz1k9l4I60bzszF1Ll7Nw5UIi+u0fw7l00nBA7kWZ o0GrpTbJwd6kzyqVF0NfW6tgFuyugjHesrfG5IaqpidTZlBHw0pKT+Zh+S5X7Hk2BWpE 1wmo4JVkueIKtaGXQ42NV6wg2o/to2ixdz6GVJJjdEaLPnlgbj2Shbjz9sKpki07bskN aHOg== X-Gm-Message-State: AFqh2krcp9IU3P6oLrSrI7R5UOO+leQUi5rYjW95lsCub0TVPud8634s /34pwCregDBYdymTLs5aUZgwC6sEvkJkOAtX X-Google-Smtp-Source: AMrXdXtXC/hEetvs1zt5WcLZyi91VWB9UTXi0nE07A5hdtBdokfxjXKJW6tyoqwFepOqYN2YYJl+4g== X-Received: by 2002:a5d:490c:0:b0:2bd:bf72:76f2 with SMTP id x12-20020a5d490c000000b002bdbf7276f2mr3619589wrq.14.1673459460125; Wed, 11 Jan 2023 09:51:00 -0800 (PST) Received: from max.int.rpsys.net ([2001:8b0:aba:5f3c:a11f:4d56:748b:c178]) by smtp.gmail.com with ESMTPSA id j30-20020a05600c1c1e00b003d9f14e9085sm11689624wms.17.2023.01.11.09.50.59 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Jan 2023 09:50:59 -0800 (PST) From: Richard Purdie To: bitbake-devel@lists.openembedded.org Subject: [PATCH 1/4] tinfoil: Don't wait for events indefinitely Date: Wed, 11 Jan 2023 17:50:55 +0000 Message-Id: <20230111175058.1526619-1-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Wed, 11 Jan 2023 17:51:11 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/14301 If for some reason the bitbake server dies, we shouldn't loop indefinitely waiting for events within tinfoil. Add a ping test and exit if things have somehow failed. Signed-off-by: Richard Purdie --- lib/bb/tinfoil.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/lib/bb/tinfoil.py b/lib/bb/tinfoil.py index 8978bb5261..91fbf1b13e 100644 --- a/lib/bb/tinfoil.py +++ b/lib/bb/tinfoil.py @@ -10,6 +10,7 @@ import logging import os import sys +import time import atexit import re from collections import OrderedDict, defaultdict @@ -729,6 +730,7 @@ class Tinfoil: ret = self.run_command('buildTargets', targets, task) if handle_events: + lastevent = time.time() result = False # Borrowed from knotty, instead somewhat hackily we use the helper # as the object to store "shutdown" on @@ -741,6 +743,7 @@ class Tinfoil: try: event = self.wait_event(0.25) if event: + lastevent = time.time() if event_callback and event_callback(event): continue if helper.eventHandler(event): @@ -785,10 +788,13 @@ class Tinfoil: self.logger.error(str(event)) result = False break - elif helper.shutdown > 1: break termfilter.updateFooter() + if time.time() > (lastevent + (3*60)): + if not self.run_command('ping', handle_events=False): + print("\nUnable to ping server and no events, closing down...\n") + return False except KeyboardInterrupt: termfilter.clearFooter() if helper.shutdown == 1: From patchwork Wed Jan 11 17:50:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 18024 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id EE6E6C5479D for ; Wed, 11 Jan 2023 17:51:11 +0000 (UTC) Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com [209.85.128.41]) by mx.groups.io with SMTP id smtpd.web10.31119.1673459462869185826 for ; Wed, 11 Jan 2023 09:51:03 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=UYH+lgAG; spf=pass (domain: linuxfoundation.org, ip: 209.85.128.41, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wm1-f41.google.com with SMTP id i17-20020a05600c355100b003d99434b1cfso13331900wmq.1 for ; Wed, 11 Jan 2023 09:51:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=54OEdukqKEOfMbADDKl5J4CKxi77QrkgEnNnZwmTOS0=; b=UYH+lgAGavmY7MsYYQhDf+7MFthS1GX1kkLY+DPKEy3QjvN3nvgGJnL2kMmUrWr5uq 0iy3zfsNrF+LgOCSEb1BT/1cQBYSIXT9MtSVvdwqoJjrN9CwRG+7XsOoPgBhqwz3GE5+ GcoeYgs0lgslED53dIHoIi4ka3sLfIRp/+1DM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=54OEdukqKEOfMbADDKl5J4CKxi77QrkgEnNnZwmTOS0=; b=LByWTxkZzYw4ZA6W0A1hQmIz33GyjtURrpdRRLsTKNXhXenqcZNYKaUtQ+lg1JK1x6 Ai7MjdJeXwS/yVF0TuDgk6D6XBVXpvx4HJcpFUKuDPszAlmWny6UHEr7oylfQV8uyUsM iXbpPttGNaI48t/u9RGpC5hyFgc0RBpKzUJYLqJfC/ZzHiyBW6PXTEwE9z6WPJgQ/Dkz cKvMthwQkz3nfL5ikqyDQL9i3NYN4Jc+SuZCvPpjZ9BYStCDYItR43LRvyIszQBKwydQ dgPBXR5e0zIYg4w++3/DHMX/ZS3X48q8xG02NbkEmMQvp+MnyzB6XnboKq4buXGLBDLc ko2w== X-Gm-Message-State: AFqh2kolpTY257/nYZ6QsDOqNiioNdAET+h3TrppqknafyZ+mtg8r46x sPQP2c2kuIGcPC8JSi5zmTxj4b2J7DT+9U/k X-Google-Smtp-Source: AMrXdXtkt3+qRF7BZkZIqfdCLeZjjJlFHB1KJTG2l86FRlRaL7c2CcK0cJp0Of4VtKKZXlnmK2OhSw== X-Received: by 2002:a7b:cd99:0:b0:3d3:5506:1bac with SMTP id y25-20020a7bcd99000000b003d355061bacmr54065642wmj.30.1673459460664; Wed, 11 Jan 2023 09:51:00 -0800 (PST) Received: from max.int.rpsys.net ([2001:8b0:aba:5f3c:a11f:4d56:748b:c178]) by smtp.gmail.com with ESMTPSA id j30-20020a05600c1c1e00b003d9f14e9085sm11689624wms.17.2023.01.11.09.51.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Jan 2023 09:51:00 -0800 (PST) From: Richard Purdie To: bitbake-devel@lists.openembedded.org Subject: [PATCH 2/4] server/process: Move heartbeat to idle thread Date: Wed, 11 Jan 2023 17:50:56 +0000 Message-Id: <20230111175058.1526619-2-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230111175058.1526619-1-richard.purdie@linuxfoundation.org> References: <20230111175058.1526619-1-richard.purdie@linuxfoundation.org> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Wed, 11 Jan 2023 17:51:11 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/14302 Rather than risk the heartbeat event code locking up the server control socket, handle it in the 'idle' thread with the other work. The aim is to remove it as a possible issue with some ongoing hangs. Signed-off-by: Richard Purdie --- lib/bb/server/process.py | 44 ++++++++++++++++++++-------------------- 1 file changed, 22 insertions(+), 22 deletions(-) diff --git a/lib/bb/server/process.py b/lib/bb/server/process.py index a44ec36139..588a3ae04d 100644 --- a/lib/bb/server/process.py +++ b/lib/bb/server/process.py @@ -441,6 +441,28 @@ class ProcessServer(): serverlog("Exception %s broke the idle_thread, exiting" % traceback.format_exc()) self.quit = True + # Create new heartbeat event? + now = time.time() + if bb.event._heartbeat_enabled and now >= self.next_heartbeat: + # We might have missed heartbeats. Just trigger once in + # that case and continue after the usual delay. + self.next_heartbeat += self.heartbeat_seconds + if self.next_heartbeat <= now: + self.next_heartbeat = now + self.heartbeat_seconds + if hasattr(self.cooker, "data"): + heartbeat = bb.event.HeartbeatEvent(now) + try: + bb.event.fire(heartbeat, self.cooker.data) + except Exception as exc: + if not isinstance(exc, bb.BBHandledException): + logger.exception('Running heartbeat function') + serverlog("Exception %s broke in idle_thread, exiting" % traceback.format_exc()) + self.quit = True + if nextsleep and bb.event._heartbeat_enabled and now + nextsleep > self.next_heartbeat: + # Shorten timeout so that we we wake up in time for + # the heartbeat. + nextsleep = self.next_heartbeat - now + if time.time() > (lastdebug + 60): lastdebug = time.time() with bb.utils.lock_timeout(self._idlefuncsLock): @@ -459,28 +481,6 @@ class ProcessServer(): self.idle = threading.Thread(target=self.idle_thread) self.idle.start() - # Create new heartbeat event? - now = time.time() - if bb.event._heartbeat_enabled and now >= self.next_heartbeat: - # We might have missed heartbeats. Just trigger once in - # that case and continue after the usual delay. - self.next_heartbeat += self.heartbeat_seconds - if self.next_heartbeat <= now: - self.next_heartbeat = now + self.heartbeat_seconds - if hasattr(self.cooker, "data"): - heartbeat = bb.event.HeartbeatEvent(now) - try: - bb.event.fire(heartbeat, self.cooker.data) - except Exception as exc: - if not isinstance(exc, bb.BBHandledException): - logger.exception('Running heartbeat function') - serverlog("Exception %s broke in idle_commands, exiting" % traceback.format_exc()) - self.quit = True - if nextsleep and bb.event._heartbeat_enabled and now + nextsleep > self.next_heartbeat: - # Shorten timeout so that we we wake up in time for - # the heartbeat. - nextsleep = self.next_heartbeat - now - if nextsleep is not None: if self.xmlrpc: nextsleep = self.xmlrpc.get_timeout(nextsleep) From patchwork Wed Jan 11 17:50:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 18026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id EF344C677F1 for ; Wed, 11 Jan 2023 17:51:11 +0000 (UTC) Received: from mail-wm1-f44.google.com (mail-wm1-f44.google.com [209.85.128.44]) by mx.groups.io with SMTP id smtpd.web11.31182.1673459462935070580 for ; Wed, 11 Jan 2023 09:51:03 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=HWDhFfh9; spf=pass (domain: linuxfoundation.org, ip: 209.85.128.44, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wm1-f44.google.com with SMTP id k26-20020a05600c1c9a00b003d972646a7dso14956920wms.5 for ; Wed, 11 Jan 2023 09:51:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=cB4Xy0JHWZj16drrMHjQj3uwQTqWpjYGCBoOHjqACfY=; b=HWDhFfh988O89wKuIBJwHjYW9YxPFKDXjyAS0SDgJq8VyP3LQCugDTg31IyB2rCQU/ +IpHjXqgcb8gRbSFSJlKuTKKWDhsG+JeMIVRi/EQNaHOqIoE/Oa4gK+dQoPPxFb5Mmgm kRGQ5qIDqno9JIg9AQVhMyXIqNrPrcqdkqxuM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cB4Xy0JHWZj16drrMHjQj3uwQTqWpjYGCBoOHjqACfY=; b=EOQgDq23x2TNHuRJ8AFnusnSGptV83EcklmlhGCy+O0R6DU9dy2dT7kb3bX0jtp4zi +yMASz+rWbRCiRHnqZZns61AB9ot+OvOTvl3y6FBaGbMHuyS5Pv2xMoh7p8kN1lPqagA fxuC61MgTobLnoZhhKn5R0c2sYw3eDabA3Fwwx0l9XOCiA/mM/YCW0MnkbA6bxti01af Lw27u0fAy5MfDVJQhZYpmxDgFNngOU9MDu8vTcukax5DSoYs5vRZR8q7Hgl0HRcWZYUS XQn2Vp30vApNwZj9pOqc16nfVI8jtRybGGy8epvknKP02XyUBd0AfACkG5rg/BxaPjLr iL8A== X-Gm-Message-State: AFqh2koU0BECHjvTrrbKIq/v8QjMf899LydDyu5xCom2G7+dgYjwZfJq zkSP7P7bSz0Qz2ECn2RDbFSPcUgGtvZ7+AnV X-Google-Smtp-Source: AMrXdXuQ89z0oSkgQL4Uz/b8SpGIa3SKRX5YEnTQNw/5y1+RzcKZfrVsLZuOX4/9cxJhn0AUO/oJNQ== X-Received: by 2002:a05:600c:1f15:b0:3cf:98e5:f72 with SMTP id bd21-20020a05600c1f1500b003cf98e50f72mr56698394wmb.3.1673459461247; Wed, 11 Jan 2023 09:51:01 -0800 (PST) Received: from max.int.rpsys.net ([2001:8b0:aba:5f3c:a11f:4d56:748b:c178]) by smtp.gmail.com with ESMTPSA id j30-20020a05600c1c1e00b003d9f14e9085sm11689624wms.17.2023.01.11.09.51.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Jan 2023 09:51:00 -0800 (PST) From: Richard Purdie To: bitbake-devel@lists.openembedded.org Subject: [PATCH 3/4] knotty: Improve shutdown handling Date: Wed, 11 Jan 2023 17:50:57 +0000 Message-Id: <20230111175058.1526619-3-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230111175058.1526619-1-richard.purdie@linuxfoundation.org> References: <20230111175058.1526619-1-richard.purdie@linuxfoundation.org> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Wed, 11 Jan 2023 17:51:11 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/14303 There are three levels of shutdown, the initial "wait for current tasks", then "stop current tasks" and "exit now". Change the code so that we don't instantly exit after "stop current tasks" but allow the events to come through from the server first. The new shutdown level allows that to then be broken out of too. Signed-off-by: Richard Purdie --- lib/bb/ui/knotty.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/lib/bb/ui/knotty.py b/lib/bb/ui/knotty.py index 7370a1adfd..431baa15ef 100644 --- a/lib/bb/ui/knotty.py +++ b/lib/bb/ui/knotty.py @@ -631,7 +631,12 @@ def main(server, eventHandler, params, tf = TerminalFilter): termfilter = tf(main, helper, console_handlers, params.options.quiet) atexit.register(termfilter.finish) - while main.shutdown < 2: + # shutdown levels + # 0 - normal operation + # 1 - no new task execution, let current running tasks finish + # 2 - interrupting currently executing tasks + # 3 - we're done, exit + while main.shutdown < 3: try: if (lastprint + printinterval) <= time.time(): termfilter.keepAlive(printinterval) @@ -644,7 +649,7 @@ def main(server, eventHandler, params, tf = TerminalFilter): termfilter.clearFooter() print("No reply after pinging server (%s, %s), exiting." % (str(error), str(ret))) return_value = 3 - main.shutdown = 2 + main.shutdown = 3 lastevent = time.time() if not parseprogress: termfilter.updateFooter() @@ -756,15 +761,15 @@ def main(server, eventHandler, params, tf = TerminalFilter): if event.error: errors = errors + 1 logger.error(str(event)) - main.shutdown = 2 + main.shutdown = 3 continue if isinstance(event, bb.command.CommandExit): if not return_value: return_value = event.exitcode - main.shutdown = 2 + main.shutdown = 3 continue if isinstance(event, (bb.command.CommandCompleted, bb.cooker.CookerExit)): - main.shutdown = 2 + main.shutdown = 3 continue if isinstance(event, bb.event.MultipleProviders): logger.info(str(event)) From patchwork Wed Jan 11 17:50:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Purdie X-Patchwork-Id: 18027 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2F51AC678D5 for ; Wed, 11 Jan 2023 17:51:12 +0000 (UTC) Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) by mx.groups.io with SMTP id smtpd.web10.31120.1673459463438189621 for ; Wed, 11 Jan 2023 09:51:03 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@linuxfoundation.org header.s=google header.b=Sa8wux1C; spf=pass (domain: linuxfoundation.org, ip: 209.85.128.45, mailfrom: richard.purdie@linuxfoundation.org) Received: by mail-wm1-f45.google.com with SMTP id l26so11646933wme.5 for ; Wed, 11 Jan 2023 09:51:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linuxfoundation.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:from:to:cc:subject:date:message-id :reply-to; bh=jWVsYbTHLS5Ge4M6kMfqhc/blCDJRRduENq5dr4B9eM=; b=Sa8wux1C4i7Q+SZHSIPZIvj2e3/hBMdWKkwZFbNRuUx0z0TDdy+i/kuGVzJbzm1RfY gTBfZIUJdovP1mHrx7Xn3mydcgObpbYwIy9ASmN1jP3VkIP55igjZjmNXgCd1+XOsmDs 4dJ9AnvCjovHO4YBezfmkdRw3ZjmGH04kf+2Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jWVsYbTHLS5Ge4M6kMfqhc/blCDJRRduENq5dr4B9eM=; b=jWdPHyabUUsFm61Sg5t7TxTvLLJsvdkCzV4Qqesbod/7rhlvTVRVWt7DS8HwinoQ6m 1ANdz8PHkzaRkv+IBVwL/L1u1AzNVoHrSFhBJd503hnXoWIEMskIY+JHQ9xw82WFMOLe AxIiPgC7fQdX+srKb66xY5j6npToKnDW95at3+GcGNXKBt88wRqGf3mhiCrfocVhcPPK hU1FwPlRwxttoybLaTRoCoHZXZJSlYkOU4QAMJtkb9L0eopTroqV0UGL+Wey40WkdjKK mPfOmZb8G6Ul7sGzhqgHLjGpTK5PeA6zXIXLUL1xtH/C0otW4u16o/Jbog9yl76Q4/Io VbKg== X-Gm-Message-State: AFqh2krFXT8uoF2joDwsF0ITPpBRY4mcJt7g4UUjxpm7DqJfFhL3Ek5Z tjSsI+OkhGC35Ly385+pl8TzXom8joVwgqtJ X-Google-Smtp-Source: AMrXdXvQTQz9s/RwjJ7TILTE+7b+p5qQfwMZgxaBLjYkO6JSjPYwy9/O7fuv5bESQekcHxxy9EHqJQ== X-Received: by 2002:a05:600c:a4f:b0:3d2:196c:270c with SMTP id c15-20020a05600c0a4f00b003d2196c270cmr55829966wmq.31.1673459461801; Wed, 11 Jan 2023 09:51:01 -0800 (PST) Received: from max.int.rpsys.net ([2001:8b0:aba:5f3c:a11f:4d56:748b:c178]) by smtp.gmail.com with ESMTPSA id j30-20020a05600c1c1e00b003d9f14e9085sm11689624wms.17.2023.01.11.09.51.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Jan 2023 09:51:01 -0800 (PST) From: Richard Purdie To: bitbake-devel@lists.openembedded.org Subject: [PATCH 4/4] cooker: Fix exit handling issues Date: Wed, 11 Jan 2023 17:50:58 +0000 Message-Id: <20230111175058.1526619-4-richard.purdie@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20230111175058.1526619-1-richard.purdie@linuxfoundation.org> References: <20230111175058.1526619-1-richard.purdie@linuxfoundation.org> MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Wed, 11 Jan 2023 17:51:12 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/bitbake-devel/message/14304 The shutdown() call should definitely not be waiting for idle, since we expect execution and events to continue even after setting either shutdown state. This was causing the UI to appear to hang at Ctrl+C interrupts. Also ensure that if we reset cooker, we stop any active parser processes since these currently appear to be being left behind. Signed-off-by: Richard Purdie --- lib/bb/cooker.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/lib/bb/cooker.py b/lib/bb/cooker.py index 5cb5c2a2b6..617d582acc 100644 --- a/lib/bb/cooker.py +++ b/lib/bb/cooker.py @@ -1743,7 +1743,7 @@ class BBCooker: return def post_serve(self): - self.shutdown(force=True, idle=False) + self.shutdown(force=True) prserv.serv.auto_shutdown() if hasattr(bb.parse, "siggen"): bb.parse.siggen.exit() @@ -1753,17 +1753,14 @@ class BBCooker: if hasattr(self, "data"): bb.event.fire(CookerExit(), self.data) - def shutdown(self, force=False, idle=True): + def shutdown(self, force=False): if force: self.state = state.forceshutdown else: self.state = state.shutdown - if idle: - self.waitIdle(30) - if self.parser: - self.parser.shutdown(clean=not force) + self.parser.shutdown(clean=False) self.parser.final_cleanup() def finishcommand(self): @@ -1775,6 +1772,7 @@ class BBCooker: def reset(self): if hasattr(bb.parse, "siggen"): bb.parse.siggen.exit() + self.finishcommand() self.initConfigurationData() self.handlePRServ()