From nobody Tue Feb 10 12:45:19 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) client-ip=216.205.24.124; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-124.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1612160862; cv=none; d=zohomail.com; s=zohoarc; b=hdNdoVgp1J7CoL3cIHKP97D84ifLvKfZwuYL1t27pFs9vOO41vqw3dIZyJLuyVAsAlOpXTAoAulvRDIQoxIftWgqPIXzC1TzJ/TGvARVXtPA4Cq8QsZDO15suAp7wkHk9KHq3c/9WLfCNRGwaINwJMpZnP3j0cqEdqnigvt75jA= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1612160862; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=tQeG6a5kWjVSNibcmtF+gpVURZZHInb04GXO57NuUI8=; b=Srx13BHWVOWMjetM8kz58VolKau8z5drsKpXd7T2yw6EgElGMouRwGt3Y9ufeYWGN+AlAUCfCrDtrki9USTpO5irovnsaXJeyHo9Pj024o4t1ZLaPOlDNabP6FfoNdlbS4BKqKKmYYC93T7LXzD7z6IFP1va060fmiGexIJ4FHc= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of redhat.com designates 216.205.24.124 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mx.zohomail.com with SMTPS id 1612160862759854.8350267974547; Sun, 31 Jan 2021 22:27:42 -0800 (PST) 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-441-55piirjDPnq347i8cmWv8Q-1; Mon, 01 Feb 2021 01:27:39 -0500 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 mimecast-mx01.redhat.com (Postfix) with ESMTPS id 7BF871005513; Mon, 1 Feb 2021 06:27:33 +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 2CE485D9DC; Mon, 1 Feb 2021 06:27:32 +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 3AF5A180954D; Mon, 1 Feb 2021 06:27:28 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id 1116RQrG025968 for ; Mon, 1 Feb 2021 01:27:26 -0500 Received: by smtp.corp.redhat.com (Postfix) id 9B68A70497; Mon, 1 Feb 2021 06:27:26 +0000 (UTC) Received: from vhost2.laine.org (ovpn-112-159.phx2.redhat.com [10.3.112.159]) by smtp.corp.redhat.com (Postfix) with ESMTP id 670EB70476 for ; Mon, 1 Feb 2021 06:27:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1612160861; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=tQeG6a5kWjVSNibcmtF+gpVURZZHInb04GXO57NuUI8=; b=bJBR9rmEUTnD6e/bj+L3kIX1IP7YD+yIdQg64jhZ9sN1yLYSBwHHN3O9V45hsZDuGiOA2v B/hXu6RI8i0HA4DeKPSQ+Db6m2LG3dIQe/6dn7nwXGtIWGI1nUiOY4PMDnJ7W1RkKSAtcr PylZ5mDMdPj5oNHN6DxZpIR0g+jpClM= X-MC-Unique: 55piirjDPnq347i8cmWv8Q-1 From: Laine Stump To: libvir-list@redhat.com Subject: [PATCH 1/8] log error if virConnectCacheOnceInit() fails Date: Mon, 1 Feb 2021 01:27:13 -0500 Message-Id: <20210201062720.425041-2-laine@redhat.com> In-Reply-To: <20210201062720.425041-1-laine@redhat.com> References: <20210201062720.425041-1-laine@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 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.14 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-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" This may be pointless, but I noticed it and it was bugging me. virGetConnectNetwork() calls virGetConnectGeneric(), which calls virConnecCacheInitialize(), which is actually a call (only once) to virConnectCacheOnceInit() which calls virThreadLocalInit() several times, which calls pthread_key_create() If pthread_key_create() fails, it (of course) doesn't log an error (because it's not a part of libvirt), nor does any other function on the call chain all the way up to virGetConnectNetwork(). But none of the callers of virGetConnectNetwork() log an error either, so it is possible that an API could fail due to virGetConnectNetwork() failing, but would only log "an error was encountered, but the cause is unknown. Deal with it." (paraphrasing). In all likelyhood, virConnectCacheOnceInit() is going to be called at some earlier time, and almost certainly pthread_key_create() will never fail (and if it does, the user will have *much* bigger problems than an obtuse error message from libvirt). So I don't know if there's any value at all in pushing this. Just throwing it out there... Signed-off-by: Laine Stump --- src/driver.c | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/src/driver.c b/src/driver.c index e005a89d57..1dae7cf284 100644 --- a/src/driver.c +++ b/src/driver.c @@ -116,18 +116,18 @@ virThreadLocal connectStorage; static int virConnectCacheOnceInit(void) { - if (virThreadLocalInit(&connectInterface, NULL) < 0) - return -1; - if (virThreadLocalInit(&connectNetwork, NULL) < 0) - return -1; - if (virThreadLocalInit(&connectNWFilter, NULL) < 0) - return -1; - if (virThreadLocalInit(&connectNodeDev, NULL) < 0) - return -1; - if (virThreadLocalInit(&connectSecret, NULL) < 0) - return -1; - if (virThreadLocalInit(&connectStorage, NULL) < 0) + if (virThreadLocalInit(&connectInterface, NULL) < 0 + || virThreadLocalInit(&connectNetwork, NULL) < 0 + || virThreadLocalInit(&connectNWFilter, NULL) < 0 + || virThreadLocalInit(&connectNodeDev, NULL) < 0 + || virThreadLocalInit(&connectSecret, NULL) < 0 + || virThreadLocalInit(&connectStorage, NULL) < 0) { + + virReportSystemError(errno, "%s", + _("Unable to initialize thread local variable= ")); return -1; + } + return 0; } =20 --=20 2.29.2