From nobody Sat Feb 7 09:36:55 2026 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.zoho.com; dkim=fail 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 149016976497140.3946925496482; Wed, 22 Mar 2017 01:02:44 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3F3514DD55; Wed, 22 Mar 2017 08:02:44 +0000 (UTC) Received: from colo-mx.corp.redhat.com (unknown [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 117A27AF7B; Wed, 22 Mar 2017 08:02:44 +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 BB2AB5EC65; Wed, 22 Mar 2017 08:02:43 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v2M82UtJ006921 for ; Wed, 22 Mar 2017 04:02:30 -0400 Received: by smtp.corp.redhat.com (Postfix) id C3DDC785D3; Wed, 22 Mar 2017 08:02:30 +0000 (UTC) Received: from mx1.redhat.com (ext-mx02.extmail.prod.ext.phx2.redhat.com [10.5.110.26]) by smtp.corp.redhat.com (Postfix) with ESMTPS id B958DC65D6 for ; Wed, 22 Mar 2017 08:02:29 +0000 (UTC) Received: from mail-pg0-f66.google.com (mail-pg0-f66.google.com [74.125.83.66]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 137076AAD1 for ; Wed, 22 Mar 2017 08:02:28 +0000 (UTC) Received: by mail-pg0-f66.google.com with SMTP id g2so29140954pge.2 for ; Wed, 22 Mar 2017 01:02:27 -0700 (PDT) Received: from prerna-saxena.dev.eng.nutanix.com. (206-15-90-246.static.twtelecom.net. [206.15.90.246]) by smtp.gmail.com with ESMTPSA id a62sm1939099pgc.60.2017.03.22.01.02.24 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 22 Mar 2017 01:02:25 -0700 (PDT) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 3F3514DD55 Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ext-mx09.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 3F3514DD55 Authentication-Results: mx1.redhat.com; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="i74QZjRc" DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 137076AAD1 Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ext-mx02.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=saxenap.ltc@gmail.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 137076AAD1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=Ztm0YtFGSBlpSCMtFfVGVHh8UNZ3cPZwl48XyZC3w0w=; b=i74QZjRck3uYOb9wdunpJIgS4h5u75FeTIzBv45UvFMj6Jl+MLe/OZXQqi+sTVZIDa vJ4wKdVL2N1VJmSxOBIbTK0peBhownRfo/1CgsixNmHLvUxxYgbrlWgVssKhFRcMrL+k xNnj4lQIooExWAa6Q3yaaqJSDCsKv/OgyTv93u+arbgrMUmRmnCSzfDprhhW4MFYy13Q iB8ZmjysvHa1x/IbtJDX9IPRgwRACYo3Xgrt8juyhPa77jsdfT7ZGrHLZGgCCaiFqfn6 O6ikhk1ZvWvKKmOK30SPhZYcexszwkwpdeLvYl3GbS1C/tDFuCnedXVRJNmqxuvbGmsT ZMQQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=Ztm0YtFGSBlpSCMtFfVGVHh8UNZ3cPZwl48XyZC3w0w=; b=okhQqm7Eo/rtzmkIAoHwGb5Bqt4KBurEH+vW41WpYTc+L+rXMKCnWY4c8WYsNw8OAa Cd6iUYlx6bcRXoVevj87voxQeCZ5/kM0/Tuzi7TpEKmZJNCfwBgdpsn0xDeuME0CtkgM sb/z4Ft6mJC6xu5JBIH+CaV320aPH3RmUw18u6bWY/07HXiqKl8o7gld+frpkRMlckDP /7m7v0wk8MVO1kv9qb3NOF1DbqQgfshrSmEhlbRLcH5qFt+b981xmxFkRDIISDaFqRIj kdc7wGt9GkdvzAsmb2Qn9KvRhoR8GiCniGVhIPw8GF8e/oAhBOowwiFoHTq5DyqHV+RB 6zVQ== X-Gm-Message-State: AFeK/H0qZWzyeCp+IBurHGTlKPA/jaBswtM+yHYCwQvQ+cvWeH0LmRyzBJBaRbw3QhqI8g== X-Received: by 10.99.253.5 with SMTP id d5mr42010629pgh.47.1490169746216; Wed, 22 Mar 2017 01:02:26 -0700 (PDT) From: Prerna Saxena To: libvirt-list@redhat.com Date: Wed, 22 Mar 2017 01:02:17 -0700 Message-Id: <1490169739-17852-2-git-send-email-saxenap.ltc@gmail.com> In-Reply-To: <1490169739-17852-1-git-send-email-saxenap.ltc@gmail.com> References: <1490169739-17852-1-git-send-email-saxenap.ltc@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 22 Mar 2017 08:02:28 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.26]); Wed, 22 Mar 2017 08:02:28 +0000 (UTC) for IP:'74.125.83.66' DOMAIN:'mail-pg0-f66.google.com' HELO:'mail-pg0-f66.google.com' FROM:'saxenap.ltc@gmail.com' RCPT:'' X-RedHat-Spam-Score: 1.07 * (BAYES_50, DCC_REPUT_13_19, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, RCVD_IN_SORBS_SPAM, SPF_PASS) 74.125.83.66 mail-pg0-f66.google.com 74.125.83.66 mail-pg0-f66.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.26 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.12 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 1/3] Debug: Add WARN'ing messages for when a client has opened/closed connection. 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.14 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.38]); Wed, 22 Mar 2017 08:02:45 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" While tracing connections from a remote client, it helps to keep track of the connection lifecycle. Messages such as the following : error : virNetSocketReadWire:1574 : End of file while reading data: Input/o= utput error are rather unhelpful. They do not indicate if the client had earlier asked = for connection closure via libvirt API. This patch introduces messages to annotate when a client connected/disconne= cted. Signed-off-by: Prerna Saxena --- src/rpc/virnetserverclient.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/rpc/virnetserverclient.c b/src/rpc/virnetserverclient.c index 85857bc..a77feaa 100644 --- a/src/rpc/virnetserverclient.c +++ b/src/rpc/virnetserverclient.c @@ -678,14 +678,19 @@ int virNetServerClientGetTLSKeySize(virNetServerClien= tPtr client) return size; } #endif - +/* + * This mostly just needs to publish the client socket FD to logs. + * It does not necessarily need a lock, or will add lock contention proble= ms. + * Replace the lock with a reference counting mechanism, to prevent the cl= ient + * object from being deallocated while this is being run + */ int virNetServerClientGetFD(virNetServerClientPtr client) { int fd =3D -1; - virObjectLock(client); + virObjectRef(client); if (client->sock) fd =3D virNetSocketGetFD(client->sock); - virObjectUnlock(client); + virObjectUnref(client); return fd; } =20 @@ -965,7 +970,9 @@ void virNetServerClientClose(virNetServerClientPtr clie= nt) virKeepAlivePtr ka; =20 virObjectLock(client); - VIR_DEBUG("client=3D%p", client); + VIR_WARN("Free'ing up resources for client=3D%p sock=3D%d", client, + virNetServerClientGetFD(client)); + if (!client->sock) { virObjectUnlock(client); return; @@ -1039,6 +1046,8 @@ void virNetServerClientDelayedClose(virNetServerClien= tPtr client) virObjectLock(client); client->delayedClose =3D true; virObjectUnlock(client); + VIR_WARN("Client=3D%p sock=3D%d requested closure of connection.", + client, virNetServerClientGetFD(client)); } =20 void virNetServerClientImmediateClose(virNetServerClientPtr client) @@ -1151,6 +1160,7 @@ static void virNetServerClientDispatchRead(virNetServ= erClientPtr client) if (client->rx->nfds =3D=3D 0) { if (virNetServerClientRead(client) < 0) { client->wantClose =3D true; + VIR_WARN("Client=3D%p sock=3D%p closed connection", client, cl= ient->sock); return; /* Error */ } } --=20 1.8.1.2 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list