seqs icon indicating copy to clipboard operation
seqs copied to clipboard

TCPListener Conn leak on RST receive

Open soypat opened this issue 1 year ago • 1 comments

As title suggests, a TCPListener connection resource is lost on a correct RST receive due to how initiating SYN packets are handled. This bug yields the following characteristic log messages (if your log level is not low enough you may only see the last message)

time=1970-01-01T00:18:54.865Z level=DEBUG msg=rcv:RST state=SynRcvd
time=1970-01-01T00:18:54.866Z level=DEBUG-2 msg=tcb:rcv.reject state=Listen rcv.nxt=203488617 rcv.wnd=2030 challenge=false
time=1970-01-01T00:18:54.899Z level=DEBUG-2 msg=tcb:rcv.reject seg.seq=3076528933 seg.ack=0 seg.wnd=0 seg.flags=[RST] seg.data=0
time=1970-01-01T00:18:54.900Z level=ERROR msg=tcb:rcv.reject err="drop segment"

followed by many msg=TCPConn.recv:start and no detailed prints on what is being received via TCP on that connection.

soypat avatar Jun 27 '24 14:06 soypat

This issue can be circumvented by using a TCPConn directly to receive data instead of a TCPListener. See https://github.com/soypat/cyw43439/blob/main/examples/tcpserver/main.go

soypat avatar Oct 24 '24 01:10 soypat