From nobody Fri May 3 06:35:47 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1571035686; cv=none; d=zoho.com; s=zohoarc; b=GbHaiTnTmDt0i7EGNoWMu8qhcdqc9tp4etNzn9bHKmJ7S/K7AAQZP5FwcfJac+jsR5ZCR0I3GHGf4pFzZRhYwHbgDvp6OjgGZ+nzQ8cJu7xf+6bxDw5X25MfBQ0TYteLAonPJoIYY0HLQW67wlP+nUwqSq2T+UUol8wCVJvCHb4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1571035686; h=Content-Type:Content-Transfer-Encoding:Cc:Date:From:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:Sender:Subject:To; bh=fh+DRAYct6m0/Qsb6F/qWaVnBgY6jTkHajVswswQllM=; b=IMK1Lmq7wxT4FQS4NHn6c1hY5/Xn6xAvimrB6AfUBkOqXpo3AzQLnt+scwaYAf3es2snACOo8zJNzLiYH6hDm8cSkQcz2uLMpXU7Km1/MMenJGaBbpEsTCaPeAaQe+gVPx33nRlM1w43ZfSJ+Fl3XKkSy3JcfmhXBI08Iv9cy5g= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 1571035686018595.4656394670959; Sun, 13 Oct 2019 23:48:06 -0700 (PDT) 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 mx1.redhat.com (Postfix) with ESMTPS id 75A95862E; Mon, 14 Oct 2019 06:48:02 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 4D377600CE; Mon, 14 Oct 2019 06:48:02 +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 0DEFF4EE6D; Mon, 14 Oct 2019 06:48:02 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x9C85IJ8002655 for ; Sat, 12 Oct 2019 04:05:19 -0400 Received: by smtp.corp.redhat.com (Postfix) id 982495C223; Sat, 12 Oct 2019 08:05:18 +0000 (UTC) Received: from mx1.redhat.com (ext-mx13.extmail.prod.ext.phx2.redhat.com [10.5.110.42]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 910895C1B2 for ; Sat, 12 Oct 2019 08:05:16 +0000 (UTC) Received: from mxct.zte.com.cn (out1.zte.com.cn [202.103.147.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 5B1173098443 for ; Sat, 12 Oct 2019 08:05:14 +0000 (UTC) Received: from mse-fl2.zte.com.cn (unknown [10.30.14.239]) by Forcepoint Email with ESMTPS id 21391C610E262381B050 for ; Sat, 12 Oct 2019 16:05:06 +0800 (CST) Received: from notes_smtp.zte.com.cn (notes_smtp.zte.com.cn [10.30.1.239]) by mse-fl2.zte.com.cn with ESMTP id x9C84s2o072914 for ; Sat, 12 Oct 2019 16:04:54 +0800 (GMT-8) (envelope-from wang.yechao255@zte.com.cn) Received: from kvm-146.localdomain ([10.74.120.146]) by szsmtp06.zte.com.cn (Lotus Domino Release 8.5.3FP6) with ESMTP id 2019101216053819-4249513 ; Sat, 12 Oct 2019 16:05:38 +0800 From: Wang Yechao To: libvir-list@redhat.com Date: Sat, 12 Oct 2019 16:04:11 +0800 Message-Id: <1570867451-10341-1-git-send-email-wang.yechao255@zte.com.cn> X-MIMETrack: Itemize by SMTP Server on SZSMTP06/server/zte_ltd(Release 8.5.3FP6|November 21, 2013) at 2019-10-12 16:05:38, Serialize by Router on notes_smtp/zte_ltd(Release 9.0.1FP7|August 17, 2016) at 2019-10-12 16:05:00, Serialize complete at 2019-10-12 16:05:00 X-MAIL: mse-fl2.zte.com.cn x9C84s2o072914 X-Greylist: Sender passed SPF test, Sender IP whitelisted by DNSRBL, ACL 238 matched, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Sat, 12 Oct 2019 08:05:15 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.42]); Sat, 12 Oct 2019 08:05:15 +0000 (UTC) for IP:'202.103.147.172' DOMAIN:'out1.zte.com.cn' HELO:'mxct.zte.com.cn' FROM:'wang.yechao255@zte.com.cn' RCPT:'' X-RedHat-Spam-Score: -2.3 (RCVD_IN_DNSWL_MED, SPF_HELO_NONE, SPF_PASS) 202.103.147.172 out1.zte.com.cn 202.103.147.172 out1.zte.com.cn X-Scanned-By: MIMEDefang 2.84 on 10.5.110.42 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.16 X-loop: libvir-list@redhat.com X-Mailman-Approved-At: Mon, 14 Oct 2019 02:45:29 -0400 Cc: Wang Yechao Subject: [libvirt] [PATCH] util: ignore SIGPIPE when writing to stderr/stdout 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: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Mon, 14 Oct 2019 06:48:03 +0000 (UTC) Content-Type: text/plain; charset="utf-8" libvirtd's stderr/stdout redirected to journald by default, so if the journald has stopped, libvirtd and libvirtd's child process will receive SIGPIPE signal when writing logs to stderr/stdout. journald stopped reasons: 1. manual command "systemctl stop systemd-journald.service" 2. oom killer kill it. ... Signed-off-by: Wang Yechao --- src/util/virlog.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/util/virlog.c b/src/util/virlog.c index 4c76fbc..127e121 100644 --- a/src/util/virlog.c +++ b/src/util/virlog.c @@ -39,6 +39,7 @@ # include #endif #include +#include =20 #include "virerror.h" #include "virlog.h" @@ -732,6 +733,9 @@ virLogOutputToFd(virLogSourcePtr source ATTRIBUTE_UNUSE= D, if (fd < 0) return; =20 + if (fd =3D=3D STDERR_FILENO || fd =3D=3D STDOUT_FILENO) + signal(SIGPIPE, SIG_IGN); + if (virAsprintfQuiet(&msg, "%s: %s", timestamp, str) < 0) return; =20 @@ -740,6 +744,10 @@ virLogOutputToFd(virLogSourcePtr source ATTRIBUTE_UNUS= ED, =20 if (flags & VIR_LOG_STACK_TRACE) virLogStackTraceToFd(fd); + + if (fd =3D=3D STDERR_FILENO || fd =3D=3D STDOUT_FILENO) + signal(SIGPIPE, SIG_DFL); + } =20 =20 --=20 1.8.3.1 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list