From patchwork Wed Mar 27 11:50:30 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Hayward X-Patchwork-Id: 32006 Received: (qmail 111641 invoked by alias); 27 Mar 2019 11:50:37 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 111359 invoked by uid 89); 27 Mar 2019 11:50:36 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-23.9 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_HELO_PASS autolearn=ham version=3.3.1 spammy=inherited, HX-Languages-Length:1819, consuming, 43, 7 X-HELO: EUR01-VE1-obe.outbound.protection.outlook.com Received: from mail-eopbgr140045.outbound.protection.outlook.com (HELO EUR01-VE1-obe.outbound.protection.outlook.com) (40.107.14.45) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 27 Mar 2019 11:50:35 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=armh.onmicrosoft.com; s=selector1-arm-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Lrkbm/FGRy5vcaoVeyEMa7Ww0P65C3LHfbEzLEHOCP4=; b=DXqzlxIEnxuj2keaIQSs406f+NKbJp9vYCVlRkpwFBM25e0R1BE4nLcbaQJvKhZOq05B3JrOpH64U9lefeCMDE48dNb/bNaAeUgKZl7LecsOv7LoWP15BuQZXqHT90si6jS37/nW4mAPP9VPr79lnVViUParQH6VzAEelNNW3o0= Received: from DB6PR0802MB2133.eurprd08.prod.outlook.com (10.172.227.22) by DB6PR0802MB2536.eurprd08.prod.outlook.com (10.172.252.10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1730.18; Wed, 27 Mar 2019 11:50:31 +0000 Received: from DB6PR0802MB2133.eurprd08.prod.outlook.com ([fe80::d122:4a29:4ae4:790c]) by DB6PR0802MB2133.eurprd08.prod.outlook.com ([fe80::d122:4a29:4ae4:790c%10]) with mapi id 15.20.1750.014; Wed, 27 Mar 2019 11:50:31 +0000 From: Alan Hayward To: "gdb-patches@sourceware.org" CC: "sergiodj@redhat.com" , nd , Alan Hayward Subject: [OBV][PATCH] Testsuite: Ensure interrupt-daemon-attach doesn't run forever Date: Wed, 27 Mar 2019 11:50:30 +0000 Message-ID: <20190327115023.8808-1-alan.hayward@arm.com> authentication-results: spf=none (sender IP is ) smtp.mailfrom=Alan.Hayward@arm.com; received-spf: None (protection.outlook.com: arm.com does not designate permitted sender hosts) x-ms-exchange-senderadcheck: 1 MIME-Version: 1.0 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-IsSubscribed: yes [Pushed because this was slowing down the Aarch64 buildbot. Sergio - it's probably worth checking if there are similar hanging processes on the other buildslave machines.] Looking at the AArch64 buildbot, I noticed about two dozen old instances of interrupt-daemon-attach taking up a full 100% cpu each. If the test fails then the test binary relies on an alarm to ensure it dies after 60 seconds. As per the Linux man page for alarm: Alarms created by alarm() ... are not inherited by children created via fork. Update the test to add an alarm in the child and also put a sleep in the child loop so it does not constantly consume cpu. Note I haven't managed to re-create why the test failed. This fix will just stop it hanging and consuming cpu when it does. gdb/testsuite/ChangeLog: 2019-03-27 Alan Hayward * gdb.base/interrupt-daemon-attach.c (main): Add alarm and sleep in child. --- gdb/testsuite/gdb.base/interrupt-daemon-attach.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/gdb/testsuite/gdb.base/interrupt-daemon-attach.c b/gdb/testsuite/gdb.base/interrupt-daemon-attach.c index 5dc84438dc..e8dddf81b4 100644 --- a/gdb/testsuite/gdb.base/interrupt-daemon-attach.c +++ b/gdb/testsuite/gdb.base/interrupt-daemon-attach.c @@ -43,6 +43,7 @@ main () break; default: + /* In parent process. */ while (1) { marker (); @@ -50,12 +51,18 @@ main () } } + /* In child process. */ + + /* Alarms are not inherited by child processes. Set the alarm again to stop + the test case running forever. */ + alarm (60); + /* Detach from controlling terminal. */ if (setsid () == (pid_t) -1) return 1; - for (;;) - ; + while (1) + usleep (1000); return 0; }