From nobody Thu May 2 02:58:31 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 170.10.153.124 as permitted sender) client-ip=170.10.153.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of redhat.com designates 170.10.153.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=fail(p=quarantine dis=quarantine) header.from=suse.com Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.153.124]) by mx.zohomail.com with SMTPS id 1633729096565979.7816804042911; Fri, 8 Oct 2021 14:38:16 -0700 (PDT) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-4-OyrUo5rXP0GeY2caNoZTqg-1; Fri, 08 Oct 2021 17:38:12 -0400 Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id E4EEA10A8E00; Fri, 8 Oct 2021 21:38:06 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 9A1A9179B3; Fri, 8 Oct 2021 21:38:04 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 138C9180598A; Fri, 8 Oct 2021 21:37:59 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.rdu2.redhat.com [10.11.54.1]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 198Lbwr4002705 for ; Fri, 8 Oct 2021 17:37:58 -0400 Received: by smtp.corp.redhat.com (Postfix) id 123D140CFD0B; Fri, 8 Oct 2021 21:37:58 +0000 (UTC) Received: from mimecast-mx02.redhat.com (mimecast03.extmail.prod.ext.rdu2.redhat.com [10.11.55.19]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0C48040CFD01 for ; Fri, 8 Oct 2021 21:37:58 +0000 (UTC) Received: from us-smtp-1.mimecast.com (us-smtp-delivery-1.mimecast.com [205.139.110.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id E3BC9811E84 for ; Fri, 8 Oct 2021 21:37:57 +0000 (UTC) Received: from de-smtp-delivery-102.mimecast.com (de-smtp-delivery-102.mimecast.com [194.104.109.102]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-230-ENQxtqrIMOqX30YXQ94ujA-1; Fri, 08 Oct 2021 17:37:56 -0400 Received: from EUR05-AM6-obe.outbound.protection.outlook.com (mail-am6eur05lp2113.outbound.protection.outlook.com [104.47.18.113]) (Using TLS) by relay.mimecast.com with ESMTP id de-mta-13-hyGJT8rcPhe_e7iMotkaAg-1; Fri, 08 Oct 2021 23:37:54 +0200 Received: from AM8PR04MB7970.eurprd04.prod.outlook.com (2603:10a6:20b:24f::9) by AM8PR04MB7395.eurprd04.prod.outlook.com (2603:10a6:20b:1c4::15) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.19; Fri, 8 Oct 2021 21:37:53 +0000 Received: from AM8PR04MB7970.eurprd04.prod.outlook.com ([fe80::2ce6:80e:c776:afbf]) by AM8PR04MB7970.eurprd04.prod.outlook.com ([fe80::2ce6:80e:c776:afbf%6]) with mapi id 15.20.4587.022; Fri, 8 Oct 2021 21:37:53 +0000 Received: from localhost (192.150.159.35) by AM5PR04CA0019.eurprd04.prod.outlook.com (2603:10a6:206:1::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.15 via Frontend Transport; Fri, 8 Oct 2021 21:37:52 +0000 X-MC-Unique: OyrUo5rXP0GeY2caNoZTqg-1 X-MC-Unique: ENQxtqrIMOqX30YXQ94ujA-1 X-MC-Unique: hyGJT8rcPhe_e7iMotkaAg-1 From: Jim Fehlig To: libvir-list@redhat.com Subject: [RFC PATCH] qemu: Do not report eof when processing monitor IO Date: Fri, 8 Oct 2021 15:37:49 -0600 Message-ID: <20211008213749.26414-1-jfehlig@suse.com> X-ClientProxiedBy: AM5PR04CA0019.eurprd04.prod.outlook.com (2603:10a6:206:1::32) To AM8PR04MB7970.eurprd04.prod.outlook.com (2603:10a6:20b:24f::9) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 590102cc-a8d4-4f53-c31b-08d98aa3e213 X-MS-TrafficTypeDiagnostic: AM8PR04MB7395: X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:4502 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0 X-Microsoft-Antispam-Message-Info: g30kOZw6+tQZV61r/fuLdM8/HNQ6dcTeLHiLkqWZi7RaFcbe6Xj9PPiWq0X9/dKwAnOotsUEHEB1kaEWJJLJAdqdKCPkb/g4xT4PUsmLf3rNuJOlq2Dq7wpAUUutBAXfyZYOCyhGW6Bgko+bEusaIZ7GEKaQQQxJLRdP8WNRyuZHyraz/CxVOv4h5WxKkYbFNWDRkd9mS7uMeSwEWbBTVN6fkOwqIYxJVw3eQHYf/VkoKW3LZxiFJhhdxRnLmu6jBaZwllwctN1ZtAz6eZb5rIrbn6watNgROl77W+CemUH6J/ag4k/u8YaDP85UwPegDfGBcuvzPtsr6EeS3DPW5hoNih7194JuONJeTmtTxsdY9AHAIHi81gWTN23ZeXmpnzBmSE2d1FJ7AaG+qZEPCZeu2LtfzgS+6LcoJ6S2RwZV2iswJwj/rsBcm20bEr6vJwuNAM93BTLgUKR1A0U/6g9ssG+QvVIA2tML1IS2aOH0KvDbAzoeiofWiQu5fGu00mNz8yCQe7Y1QCJSnHQoKF7VYyrzDXe/QGJ2vLiu5iGmPkEJmZ93CoiFk065TTHi84oLALDTLslmg8qos6ke5DEDXmCXCsfk2rHsNbDZgIBRngNkTSqVl+pa+WLw2N1SMWCBwnFGzer2n6ljwVIH3AkO04jN9OQoaoQ5lhHuy56sXGmuzCSGTnnL8aeIReNSaNSuoQJKfi2h1drkY2BJoKsFs3ygJAqaDbHMrPxQXU8= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM8PR04MB7970.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(366004)(956004)(36756003)(6486002)(8676002)(966005)(2616005)(83380400001)(6916009)(38100700002)(26005)(66476007)(66556008)(2906002)(66946007)(6496006)(316002)(5660300002)(86362001)(1076003)(508600001)(8936002)(186003)(6666004); DIR:OUT; SFP:1101 X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?us-ascii?Q?F00UoxpZZiwaziAy7GvcOTpfMMs6xiH9ZGXkd1NKvWjhifkReXAzC1hpbMtb?= =?us-ascii?Q?vSmBYgZASBWJILA75Jr7h3Uy7EwW9OH7Dv7+yiMnkgPFooocx9/0TvNk6bmh?= =?us-ascii?Q?l/ZIa7zwyzmmq29Ri+EtjxS+dcX0IZm5jXA+SdPrMA4fKlgTKOuEBem1NdKk?= =?us-ascii?Q?I4ncr0xIXumwarIm6zSqhrTC/r/g9eSQkW2wvCGDImn8PAkgvS55EK+wDhtr?= =?us-ascii?Q?ri1Oul1r9Vk8kFKfYvNYfOXIykRRHg096RAMJoZdqiI1uld0E7dUomiyFp+B?= =?us-ascii?Q?Z3C9jDZ49wdZo6aLjl757vr659fBG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?Q?h+nVuBXZ44CbhYlgUxQ26FIzWVcCTaUh4Lh5vUpZkxmKjLG8+NV61bL9altV?= =?us-ascii?Q?LJzDIUKTtZ+qAMDVHLKDRmZzTA2DAHOVskN2XBNcm+xq0m3oQNfsinyrMQwn?= =?us-ascii?Q?DLgrjM8DqVQXPZqcJkdqoTW/?= X-OriginatorOrg: suse.com X-MS-Exchange-CrossTenant-Network-Message-Id: 590102cc-a8d4-4f53-c31b-08d98aa3e213 X-MS-Exchange-CrossTenant-AuthSource: AM8PR04MB7970.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Oct 2021 21:37:52.9641 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: f7a17af6-1c5c-4a36-aa8b-f5be247aa4ba X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: EGPfnfx7qjCxHlPLNVy33WKcDJH1XJiVy3edBsEqisGx6TTaKBkpOWBiifywNM8J6weTf0zVkm3yZc+lHbJxdQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM8PR04MB7395 X-Mimecast-Impersonation-Protect: Policy=CLT - Impersonation Protection Definition; Similar Internal Domain=false; Similar Monitored External Domain=false; Custom External Domain=false; Mimecast External Domain=false; Newly Observed Domain=false; Internal User Name=false; Custom Display Name List=false; Reply-to Address Mismatch=false; Targeted Threat Dictionary=false; Mimecast Threat Dictionary=false; Custom Threat Dictionary=false X-Scanned-By: MIMEDefang 2.84 on 10.11.54.1 X-MIME-Autoconverted: from quoted-printable to 8bit by lists01.pubmisc.prod.ext.phx2.redhat.com id 198Lbwr4002705 X-loop: libvir-list@redhat.com X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=libvir-list-bounces@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: quoted-printable X-ZM-MESSAGEID: 1633729098168100003 Content-Type: text/plain; charset="utf-8" There have been countless reports from users concerned about the following error reported by libvirtd when qemu domains are shutdown internal error: End of file from qemu monitor While the error is harmless, users often mistaken it for real problem with their deployments. EOF from the monitor can't be entirely ignored since other threads may be using the monitor and must be able to detect the EOF condition. One potential fix is to delay reporting EOF until the monitor is used after EOF is detected. This patch adds a 'goteof' member to the qemuMonitor structure, which is set when EOF is detected on the monitor socket. If another thread later tries to send data on the monitor, the EOF error is reported. Signed-off-by: Jim Fehlig --- An RFC patch to squelch qemu monitor EOF error messages on VM shutdown. Previous discussions and information on testing of the patch can be found in this thread https://listman.redhat.com/archives/libvir-list/2021-September/msg00949.html src/qemu/qemu_monitor.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/src/qemu/qemu_monitor.c b/src/qemu/qemu_monitor.c index 5fc23f13d3..751ec8ba6c 100644 --- a/src/qemu/qemu_monitor.c +++ b/src/qemu/qemu_monitor.c @@ -113,6 +113,7 @@ struct _qemuMonitor { =20 /* true if qemu no longer wants 'props' sub-object of object-add */ bool objectAddNoWrap; + bool goteof; }; =20 /** @@ -526,10 +527,10 @@ qemuMonitorIO(GSocket *socket G_GNUC_UNUSED, { qemuMonitor *mon =3D opaque; bool error =3D false; - bool eof =3D false; bool hangup =3D false; =20 virObjectRef(mon); + mon->goteof =3D false; =20 /* lock access to the monitor and protect fd */ virObjectLock(mon); @@ -544,7 +545,7 @@ qemuMonitorIO(GSocket *socket G_GNUC_UNUSED, =20 if (mon->lastError.code !=3D VIR_ERR_OK) { if (cond & (G_IO_HUP | G_IO_ERR)) - eof =3D true; + mon->goteof =3D true; error =3D true; } else { if (cond & G_IO_OUT) { @@ -562,7 +563,7 @@ qemuMonitorIO(GSocket *socket G_GNUC_UNUSED, if (errno =3D=3D ECONNRESET) hangup =3D true; } else if (got =3D=3D 0) { - eof =3D true; + mon->goteof =3D true; } else { /* Ignore hangup/error cond if we read some data, to * give time for that data to be consumed */ @@ -575,22 +576,19 @@ qemuMonitorIO(GSocket *socket G_GNUC_UNUSED, =20 if (cond & G_IO_HUP) { hangup =3D true; - if (!error) { - virReportError(VIR_ERR_INTERNAL_ERROR, "%s", - _("End of file from qemu monitor")); - eof =3D true; - } + if (!error) + mon->goteof =3D true; } =20 - if (!error && !eof && + if (!error && !mon->goteof && cond & G_IO_ERR) { virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Invalid file descriptor while waiting for mo= nitor")); - eof =3D true; + mon->goteof =3D true; } } =20 - if (error || eof) { + if (error || mon->goteof) { if (hangup && mon->logFunc !=3D NULL) { /* Check if an error message from qemu is available and if so,= use * it to overwrite the actual message. It's done only in early @@ -609,7 +607,7 @@ qemuMonitorIO(GSocket *socket G_GNUC_UNUSED, /* Already have an error, so clear any new error */ virResetLastError(); } else { - if (virGetLastErrorCode() =3D=3D VIR_ERR_OK) + if (virGetLastErrorCode() =3D=3D VIR_ERR_OK && !mon->goteof) virReportError(VIR_ERR_INTERNAL_ERROR, "%s", _("Error while processing monitor IO")); virCopyLastError(&mon->lastError); @@ -630,7 +628,7 @@ qemuMonitorIO(GSocket *socket G_GNUC_UNUSED, /* We have to unlock to avoid deadlock against command thread, * but is this safe ? I think it is, because the callback * will try to acquire the virDomainObj *mutex next */ - if (eof) { + if (mon->goteof) { qemuMonitorEofNotifyCallback eofNotify =3D mon->cb->eofNotify; virDomainObj *vm =3D mon->vm; =20 @@ -949,6 +947,11 @@ qemuMonitorSend(qemuMonitor *mon, virSetError(&mon->lastError); return -1; } + if (mon->goteof) { + virReportError(VIR_ERR_INTERNAL_ERROR, "%s", + _("End of file from qemu monitor")); + return -1; + } =20 mon->msg =3D msg; qemuMonitorUpdateWatch(mon); --=20 2.33.0