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 7EDE3A0C41; Fri, 16 Apr 2021 10:22:08 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 625E1141BB6; Fri, 16 Apr 2021 10:22:08 +0200 (CEST) Received: from szxga05-in.huawei.com (szxga05-in.huawei.com [45.249.212.191]) by mails.dpdk.org (Postfix) with ESMTP id 80C6A14176E for ; Fri, 16 Apr 2021 10:22:06 +0200 (CEST) Received: from DGGEMS407-HUB.china.huawei.com (unknown [172.30.72.59]) by szxga05-in.huawei.com (SkyGuard) with ESMTP id 4FM8Hv3x34zPr3g; Fri, 16 Apr 2021 16:19:07 +0800 (CST) Received: from [10.67.103.128] (10.67.103.128) by DGGEMS407-HUB.china.huawei.com (10.3.19.207) with Microsoft SMTP Server id 14.3.498.0; Fri, 16 Apr 2021 16:21:58 +0800 To: David Marchand CC: dev , "Yigit, Ferruh" , Ciara Power , "Pattan, Reshma" 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> From: "Min Hu (Connor)" Message-ID: <98807f34-af5a-8de8-f4ef-f4a0e57ce077@huawei.com> Date: Fri, 16 Apr 2021 16:21:58 +0800 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.3.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset="utf-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.67.103.128] X-CFilter-Loop: Reflected 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" Hi, David, fixed in v4. Thanks. 在 2021/4/15 22:55, David Marchand 写道: > 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 > > . >