Skip to content

Commit e14bb5f

Browse files
sunaaaaaaadavid-marchand
authored andcommitted
telemetry: fix connected clients count
Telemetry can only create 10 conns by default, each of which is processed by a thread. When a thread fails to write using socket, the thread will end directly without reducing the total number of conns. This will result in the machine running for a long time, and if there are 10 failures, the telemetry will be unavailable Fixes: 2a7d0b8 ("telemetry: add upper limit on connections") Cc: [email protected] Signed-off-by: Shaowei Sun <[email protected]> Acked-by: Bruce Richardson <[email protected]> Acked-by: Ciara Power <[email protected]> Acked-by: Chengwen Feng <[email protected]>
1 parent 3178e37 commit e14bb5f

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

.mailmap

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,6 +1281,7 @@ Shally Verma <[email protected]> <[email protected]>
12811281
Shannon Nelson <[email protected]>
12821282
Shannon Zhao <[email protected]>
12831283
Shaopeng He <[email protected]>
1284+
Shaowei Sun <[email protected]>
12841285
Sharmila Podury <[email protected]>
12851286
Sharon Haroni <[email protected]>
12861287
Shay Agroskin <[email protected]>

lib/telemetry/telemetry.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -378,8 +378,8 @@ client_handler(void *sock_id)
378378
"{\"version\":\"%s\",\"pid\":%d,\"max_output_len\":%d}",
379379
telemetry_version, getpid(), MAX_OUTPUT_LEN);
380380
if (write(s, info_str, strlen(info_str)) < 0) {
381-
close(s);
382-
return NULL;
381+
TMTY_LOG_LINE(ERR, "Socket write base info to client failed");
382+
goto exit;
383383
}
384384

385385
/* receive data is not null terminated */
@@ -404,6 +404,7 @@ client_handler(void *sock_id)
404404

405405
bytes = read(s, buffer, sizeof(buffer) - 1);
406406
}
407+
exit:
407408
close(s);
408409
rte_atomic_fetch_sub_explicit(&v2_clients, 1, rte_memory_order_relaxed);
409410
return NULL;

0 commit comments

Comments
 (0)