한국어English日本語简体中文繁體中文DeutschไทยTiếng ViệtРусскийPortuguês (Brasil)EspañolBahasa Indonesia

Game Lag White Paper › L8 Sockets and protocols

Last data lost to an abortive close (RST) SO_LINGER, abrupt RST

Cause ID sk-linger · Primary owner Game team (Server development)

Open the interactive card with figures and simulations →

When the server cuts a connection abruptly, the final notice or save-complete signal it sent is lost.

Why The server closes the connection with an abortive close (RST). This happens when SO_LINGER is set to 0 seconds, or when the socket is closed before all received data has been read → Effect The kick reason and final data still in transit are thrown away → On screen An unexplained “Connection closed due to an unknown error”

Symptoms
Disconnect
Factors
Packet loss
Who’s affected
Just me
When
Randomly
Owner
Primary owner Game team (Server development)
Game team action items
Send the reason, then close only the sending direction (shutdown), read incoming data until the other side closes and only then close the socket, avoid SO_LINGER of 0 seconds.
On the graph
Random spikes · Connections ended by RST
Where to look
Increase in TcpExtTCPAbortOnData (closed with RST while data was left to send, SO_LINGER 0 s) and TcpExtTCPAbortOnClose (closed with unread data left) from nstat -az, and whether a server-side packet capture at the moment of disconnect shows an RST going out where a FIN should be
Confirmed if
At the times of “Connection closed due to an unknown error” reports, the server sends RST, and AbortOnData and AbortOnClose rise
Ruled out if
Server closed normally with FIN, yet the reason still doesn’t show: the client’s close handling
Check with
Infra tools (no game code needed)

Sources

  1. closesocket function (winsock.h) Microsoft
    Turning SO_LINGER on with a time of 0 makes close an abortive close that resets the connection immediately, and unsent data is lost
  2. RFC 9293: Transmission Control Protocol (TCP) IETF
    Closing while received data is still unread sends an RST to signal data loss
  3. Graceful Shutdown, Linger Options, and Socket Closure Microsoft
    The sequence: shut down only the sending side first with shutdown, then close the socket after receiving the other side’s close notification
  4. SNMP counter Linux kernel
    TcpExtTCPAbortOnData: closed with RST while data was left to send (SO_LINGER 0 s, for example); TcpExtTCPAbortOnClose: closed with unread data left, sending RST

See also

Same layer: L8 Sockets and protocols

Same symptom (Disconnect), other layers

View the interactive card with figures and simulations