Troubleshooting
Problem
Application closes Non Blocking socket before connect completes (socket writable) but netstat conn command shows connection in syn_sent state.
Cause
The application that issued the Non Blocking connect determines that it should be abandoned either because a select () timer expires or timer internal to the application expires. The application then issues a close() on this socket which results in a FIN packet that is queued on connection until a 3 minute, internally hardcoded, connection establishment timer expires. During this 3 minute window the TCP layer continues to retransmit the original SYN packet from the connect() that was abandoned.
Resolving The Problem
Before issuing the close(), the application should set the so_linger option on with a linger time value of zero by way of the setsockopt() function. This will cause a reset packet to be generated and the connection immediately aborted with no further SYN retransmissions.
Was this topic helpful?
Document Information
Modified date:
15 June 2018
UID
swg21220159