From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dan.rpsys.net (5751f4a1.skybroadband.com [87.81.244.161]) by mail.openembedded.org (Postfix) with ESMTP id BB85373243 for ; Wed, 9 Sep 2015 21:44:51 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by dan.rpsys.net (8.14.4/8.14.4/Debian-4.1ubuntu1) with ESMTP id t89Lipu2011925 for ; Wed, 9 Sep 2015 22:44:51 +0100 Received: from dan.rpsys.net ([127.0.0.1]) by localhost (dan.rpsys.net [127.0.0.1]) (amavisd-new, port 10024) with LMTP id e7zUoeme8zLt for ; Wed, 9 Sep 2015 22:44:51 +0100 (BST) Received: from [192.168.3.10] ([192.168.3.10]) (authenticated bits=0) by dan.rpsys.net (8.14.4/8.14.4/Debian-4.1ubuntu1) with ESMTP id t89LibMS011908 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NOT) for ; Wed, 9 Sep 2015 22:44:48 +0100 Message-ID: <1441835077.24871.313.camel@linuxfoundation.org> From: Richard Purdie To: bitbake-devel Date: Wed, 09 Sep 2015 22:44:37 +0100 X-Mailer: Evolution 3.12.11-0ubuntu3 Mime-Version: 1.0 Subject: [PATCH] bitbake-worker: Ensure pipe closure doesn't crash before killpg() X-BeenThere: bitbake-devel@lists.openembedded.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: Patches and discussion that advance bitbake development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Sep 2015 21:44:54 -0000 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit If the pipe is closed, we want to ensure that we kill any child processes by triggering the sigterm handler before we exit. This code does that, hopefully avoiding the remaining process left behind issues on the autobuilder. Signed-off-by: Richard Purdie diff --git a/bitbake/bin/bitbake-worker b/bitbake/bin/bitbake-worker index 0551d02..9a6b467 100755 --- a/bitbake/bin/bitbake-worker +++ b/bitbake/bin/bitbake-worker @@ -87,7 +87,11 @@ def worker_child_fire(event, d): global worker_pipe data = "" + pickle.dumps(event) + "" - worker_pipe.write(data) + try: + worker_pipe.write(data) + except IOError: + sigterm_handler(None, None) + raise bb.event.worker_fire = worker_fire