Bug 1364

Summary: telemetry conns may leak in certain situation
Product: DPDK Reporter: sun (1819846787)
Component: otherAssignee: dev
Status: CONFIRMED ---    
Severity: normal CC: ciara.power, david.marchand
Priority: Normal    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: All   

Description sun 2024-01-13 06:59:35 CET
Every time the telemetry server successfully returns from the accept, it atomically increases the value of num_clients(if < MAX_CONNECTIONS) and then executes pthread_create to create a thread to execute the client_handler function. In this function, some information will be written to the client. If the write fails, the thread returns NULL without atomically reducing num_clients, this will cause the Telemetry server to run for a period of time, and the value of num_clients will be greater than 10, resulting in telemetry being unavailable. 
Therefore, the decrease in atomicity v2_clients should occur after the write() failure
Comment 1 David Marchand 2024-01-15 09:03:37 CET
Thanks for the report.

A call to write() failing is likely a sign that something is wrong with the system but the analysis looks correct to me.
A fix could be to add a out: label at the end of the function, and jump to this label if write() fails.

Can you send a patch or do you prefer someone from the dpdk community handles it?
Comment 2 Ciara Power 2024-01-19 16:45:18 CET
Fix patch sent by reporter - thanks!
https://patches.dpdk.org/project/dpdk/patch/tencent_69E4B1D2B6C0865DA223940C173EC4904506@qq.com/