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 6FD18A0C3F; Thu, 15 Apr 2021 16:56:03 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 3D8821622D7; Thu, 15 Apr 2021 16:56:03 +0200 (CEST) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [216.205.24.124]) by mails.dpdk.org (Postfix) with ESMTP id 1C0FF1622D3 for ; Thu, 15 Apr 2021 16:56:01 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1618498561; 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: in-reply-to:in-reply-to:references:references; bh=1EO6AYNkxnrwXfPQs1CgeJtc6SHj3bRLy9aLP0o2KiM=; b=XtN8BdimNOCAATKBkX6ANe8NLxvzi68pOTsgjvfwn3ikUBxIF/F2NwpnPEpTOPx6hZGsZT 7SwfociwjYrWz5K4ymlapUpM3zuMumDj0EahhgEzLtmwDapjfPUsllj0fjU5CO4r8z/Tqy NF9X0RRU+Reu4cgBT62rqn32ux7qu5E= Received: from mail-vk1-f197.google.com (mail-vk1-f197.google.com [209.85.221.197]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-301--m8LH3HINdyVWw2Dh76nDw-1; Thu, 15 Apr 2021 10:55:59 -0400 X-MC-Unique: -m8LH3HINdyVWw2Dh76nDw-1 Received: by mail-vk1-f197.google.com with SMTP id s75-20020a1f454e0000b02901e1192c9351so336693vka.8 for ; Thu, 15 Apr 2021 07:55:58 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=1EO6AYNkxnrwXfPQs1CgeJtc6SHj3bRLy9aLP0o2KiM=; b=SoTkHIwSSoPIGmcSYgVrn8CbtV7OUj1r2M5OC0Zsm3dI7YVOcuRWyVbxOlA3/CTu3F sRJi/fMoh7ZbcXFBmQCbrx+Y1TI08zdKVewWHjpMUnVqogyO0d3Lp8lK1gQJsyFrtQMV b9XN+CBBobfe1M+Iws7/5GDnlYRihRq6IvZFpyygk6nFE50UGU4KTVCfqeAzxvrzyDqO lanSKSZf1XAWltcx4f0AALHAt1fqBh/MHPFuGb1pohoOjK7aeVPQBln3eIeEkT9d9Zz3 8Kbh9uX6b09PFXduxuXw2bKc6csM/fhqgHWcGgTU49maTpLflSc2GEhXXu6PEVXxluqf bvyA== X-Gm-Message-State: AOAM532d4NyB4SA67L5YDoGGyq5/ow7POoqCSbv6T1CWswC+LzjTHK2S xHRr0lyn1EoyQAurXfCBascB7wVJSLbfdhPFMsiJQrdvsgVbnSHikCTqC7c25T4bQpVGT5Rw3Il UEQmxQOrMBcZStR5RSmA= X-Received: by 2002:a67:f84a:: with SMTP id b10mr2450796vsp.10.1618498558271; Thu, 15 Apr 2021 07:55:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx+kFEywmr31nlB2L6/goqXVjSl5BnL24/ofHkYHov//bih7s8ZRCS3VQ2qIPIuuVx6ZyFs4m+9+3Qiqaz50PY= X-Received: by 2002:a67:f84a:: with SMTP id b10mr2450777vsp.10.1618498558026; Thu, 15 Apr 2021 07:55:58 -0700 (PDT) MIME-Version: 1.0 References: <1618051453-21264-1-git-send-email-humin29@huawei.com> <1618487412-26678-1-git-send-email-humin29@huawei.com> <1618487412-26678-2-git-send-email-humin29@huawei.com> In-Reply-To: <1618487412-26678-2-git-send-email-humin29@huawei.com> From: David Marchand Date: Thu, 15 Apr 2021 16:55:46 +0200 Message-ID: To: "Min Hu (Connor)" Cc: dev , "Yigit, Ferruh" , Ciara Power , "Pattan, Reshma" Authentication-Results: relay.mimecast.com; auth=pass smtp.auth=CUSA124A263 smtp.mailfrom=dmarchan@redhat.com X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset="UTF-8" Subject: Re: [dpdk-dev] [PATCH v3 1/2] telemetry: fix missing check for thread creation X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" On Thu, Apr 15, 2021 at 1:50 PM Min Hu (Connor) wrote: > diff --git a/lib/librte_telemetry/telemetry.c b/lib/librte_telemetry/telemetry.c > index 7e08afd..e6a99f3 100644 > --- a/lib/librte_telemetry/telemetry.c > +++ b/lib/librte_telemetry/telemetry.c > @@ -350,6 +350,7 @@ socket_listener(void *socket) > { > while (1) { > pthread_t th; > + int rc; > struct socket *s = (struct socket *)socket; > int s_accepted = accept(s->sock, NULL, NULL); > if (s_accepted < 0) { > @@ -366,7 +367,12 @@ socket_listener(void *socket) > __atomic_add_fetch(s->num_clients, 1, > __ATOMIC_RELAXED); > } > - pthread_create(&th, NULL, s->fn, (void *)(uintptr_t)s_accepted); > + rc = pthread_create(&th, NULL, s->fn, (void *)(uintptr_t)s_accepted); > + if (rc != 0) { > + TMTY_LOG(ERR, "Error with create client thread\n"); > + close(s_accepted); > + return NULL; > + } Repeating my comment: Either you use this rc variable (adding strerror(rc) in the log message in TMTY_LOG()) or you remove the variable and simply test if (pthread_create(...) != 0). This comment applies to other changes in this patch. And this applies to patch 2 too. > pthread_detach(th); > } > return NULL; Thanks. -- David Marchand