From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
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 <dev@dpdk.org>; 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 <david.marchand@redhat.com>
CC: dev <dev@dpdk.org>, "Yigit, Ferruh" <ferruh.yigit@intel.com>, Ciara Power
 <ciara.power@intel.com>, "Pattan, Reshma" <reshma.pattan@intel.com>
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>
 <CAJFAV8y_idFJcqUz=uCAm5AKYyN4HDkm6MNB5QoW_3=EjYssDQ@mail.gmail.com>
From: "Min Hu (Connor)" <humin29@huawei.com>
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: <CAJFAV8y_idFJcqUz=uCAm5AKYyN4HDkm6MNB5QoW_3=EjYssDQ@mail.gmail.com>
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 <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>

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) <humin29@huawei.com> 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
> 
> .
>