nxtrace / NTrace-V1

NextTrace Dev
https://www.nxtrace.org
GNU General Public License v3.0
266 stars 22 forks source link

[bugfix] fix inflightRequestLock deadlock in tcp/udp tracing #60

Closed FyZhu97 closed 4 months ago

FyZhu97 commented 4 months ago

take ipv4 tcp tracer as an example: In tracer/tcp_ipv4, TCPTracer.send() make a channel without buffer which is used to receive the result hop. image

However, when send() is timeout, the func returns. So there will be no receivers to receive the channel, which causes the channel blocked forever. image The result hop sended to the channel after timeout will block forever too. And the inflightRequestLock never unlocks, causing all the send() goroutines blocked forever and the waitgroup will never done. Then, deadlock. image The same thing occurs in ipv6 tcp and udp tracer too.

This bugfix makes the channel with 1 buffer, which can avoid the send block.

tsosunchia commented 4 months ago

well done