From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 5A3EFA0548 for ; Wed, 29 Sep 2021 14:29:01 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 4E291410EF; Wed, 29 Sep 2021 14:29:01 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 341D540685 for ; Wed, 29 Sep 2021 14:28:59 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1632918537; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oyqn45EYdq07k4kEEWQW4scvgEy+19/rw8885o3Iy2A=; b=hi5mgf+KTx5Yg6ugkjJQh8tcOiRwwtq5XZ/KLrd1Uyj8yGKvZbPQV+0GJiRD2jk0oxT3h2 GLC3W4HQFm1VMEXrm3+8Y0I0HChOINw5P9nvPIfY9gHT0DluwAX9/lWJ3kKx/R3tl6TsnT dYbAjFndgPhM9F2usXxa8mIOs3Rsi38= Received: from mail-wm1-f72.google.com (mail-wm1-f72.google.com [209.85.128.72]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-126-sBNVitD8NAads9g4KLC0BQ-1; Wed, 29 Sep 2021 08:28:56 -0400 X-MC-Unique: sBNVitD8NAads9g4KLC0BQ-1 Received: by mail-wm1-f72.google.com with SMTP id n3-20020a7bcbc3000000b0030b68c4de38so777701wmi.8 for ; Wed, 29 Sep 2021 05:28:56 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent :content-language:to:cc:references:from:subject:in-reply-to :content-transfer-encoding; bh=oyqn45EYdq07k4kEEWQW4scvgEy+19/rw8885o3Iy2A=; b=UUvxOcHEISFxz2bds/3j+4QYbu7714r6ZjNodDoH03PgVbL7TRdOi0nK5G7JSg4F+x vz46tvCSnVHfQ44bBqrPG2wAMWAONsLNV5fwPEEoWC8ZktE5oLylISnGHPLyA1TkSchK 4ngt8btRnNsNqnGbUN7i0k7Z1NaGPR6idxqPjgPor/xIyoCzFYvFAXvmALMiyP3t67AE CifDxjeBUQBkJTgVW3bUOcIaTYXSdbgmcKv53AIMsh5OIE0fdCd3NlXAMbGd19diJbao eIwZ1xwjSzbqqJ6qVQYAoUA/PxZS/W42Y0CqqwTiFvMf0fo+Z4mMJKg2iDhvOAt3HgwL k6cg== X-Gm-Message-State: AOAM532V6MNrlIc0lGY6vv6xQmAu7fe3iDPBcGUaNWuB1lVDLw8OLwIr 65ILEhoxI0Ocn3tp3Ol5yIAYWvgK8EbVbpDEbp/eK3xK7B/bwoGO4vIbxRg4O2EAMB3888PVeCU KRuqVY70= X-Received: by 2002:a1c:2289:: with SMTP id i131mr9975193wmi.34.1632918535587; Wed, 29 Sep 2021 05:28:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwa76Y1NhZ7cr1vj9kRySBK+EvAeZHT9wjYe2QYMhHIzTJPw+AdK0M1xe4M7UO6Hk/ozyfK8w== X-Received: by 2002:a1c:2289:: with SMTP id i131mr9975174wmi.34.1632918535356; Wed, 29 Sep 2021 05:28:55 -0700 (PDT) Received: from [192.168.0.36] ([78.19.105.235]) by smtp.gmail.com with ESMTPSA id z6sm2136020wmp.1.2021.09.29.05.28.54 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 29 Sep 2021 05:28:54 -0700 (PDT) Message-ID: <6ea20d4e-a7dd-afcb-3ca1-ffc023114d72@redhat.com> Date: Wed, 29 Sep 2021 13:28:53 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.0 To: Bruce Richardson , dev@dpdk.org Cc: ciara.power@intel.com, anatoly.burakov@intel.com, stable@dpdk.org, David Marchand References: <20210915141030.23514-1-bruce.richardson@intel.com> <20210924161842.2879019-1-bruce.richardson@intel.com> From: Kevin Traynor In-Reply-To: <20210924161842.2879019-1-bruce.richardson@intel.com> Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=ktraynor@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [dpdk-stable] [dpdk-dev] [PATCH v2] telemetry: fix "in-memory" process socket conflicts X-BeenThere: stable@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: patches for DPDK stable branches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: stable-bounces@dpdk.org Sender: "stable" Hi Bruce, On 24/09/2021 17:18, Bruce Richardson wrote: > When DPDK is run with --in-memory mode, multiple processes can run > simultaneously using the same runtime dir. This leads to each process > removing another process' telemetry socket as it started up, giving > unexpected behaviour. > > This patch changes that behaviour to first check if the existing socket > is active. If not, it's an old socket to be cleaned up and can be > removed. If it is active, telemetry initialization fails and an error > message is printed out giving instructions on how to remove the error; > either by using file-prefix to have a different runtime dir (and > therefore socket path) or by disabling telemetry if it not needed. > telemetry is enabled by default but it may not be used by the application. Hitting this issue will cause rte_eal_init() to fail which will probably stop or severely limit the application. So it could change a working application to a non-working one (albeit one that doesn't interfere with other process' sockets). Can it just print a warning that telemetry will not be enabled and continue so it's not returning an rte_eal_init failure? A more minor thing, I see it changes the behaviour from, last one runs with telemetry, to, first one runs with telemetry. Though it can be figured from the commit message, it might be worth calling that change out explicitly. thanks, Kevin. > Fixes: 6dd571fd07c3 ("telemetry: introduce new functionality") > Cc: stable@dpdk.org > > Reported-by: David Marchand > Signed-off-by: Bruce Richardson > --- > v2: fix build error on FreeBSD > --- > lib/telemetry/telemetry.c | 25 ++++++++++++++++++++----- > 1 file changed, 20 insertions(+), 5 deletions(-) > > diff --git a/lib/telemetry/telemetry.c b/lib/telemetry/telemetry.c > index 8304fbf6e9..78508c1a1d 100644 > --- a/lib/telemetry/telemetry.c > +++ b/lib/telemetry/telemetry.c > @@ -457,15 +457,30 @@ create_socket(char *path) > > struct sockaddr_un sun = {.sun_family = AF_UNIX}; > strlcpy(sun.sun_path, path, sizeof(sun.sun_path)); > - unlink(sun.sun_path); > + > if (bind(sock, (void *) &sun, sizeof(sun)) < 0) { > struct stat st; > > - TMTY_LOG(ERR, "Error binding socket: %s\n", strerror(errno)); > - if (stat(socket_dir, &st) < 0 || !S_ISDIR(st.st_mode)) > + /* first check if we have a runtime dir */ > + if (stat(socket_dir, &st) < 0 || !S_ISDIR(st.st_mode)) { > TMTY_LOG(ERR, "Cannot access DPDK runtime directory: %s\n", socket_dir); > - sun.sun_path[0] = 0; > - goto error; > + goto error; > + } > + > + /* check if current socket is active */ > + if (connect(sock, (void *)&sun, sizeof(sun)) == 0) { > + TMTY_LOG(ERR, "Error binding telemetry socket, path already in use\n"); > + TMTY_LOG(ERR, "Use '--file-prefix' to select a different socket path, or '--no-telemetry' to disable\n"); > + path[0] = 0; > + goto error; > + } > + > + /* socket is not active, delete and attempt rebind */ > + unlink(sun.sun_path); > + if (bind(sock, (void *) &sun, sizeof(sun)) < 0) { > + TMTY_LOG(ERR, "Error binding socket: %s\n", strerror(errno)); > + goto error; > + } > } > > if (listen(sock, 1) < 0) { >