Hello Lucera team,
While investigating player disconnects during an open beta using the Classic protocol 166 client, we found that both the AuthServer and the GameServer closed the client session when SocketChannel.read() returned 0. We reproduced this behavior in controlled tests against both server binaries.
On a non-blocking TCP connection, a return value of 0 means that no bytes were read during that call. The connection can still be open, and the rest of a message may arrive later. Java reports end-of-stream by returning -1. Java 17 SocketChannel.read() documentation
We updated the selector to keep the session open, preserve any bytes already buffered, and wait for the next read event when a read returns 0. A return value of -1 still closes the session normally. Existing handling for I/O errors and invalid packets remains in place.
After the change, the same test kept the session open on both services. We also verified that direct connections and connections using PROXY protocol v2 could process fragmented input and detect a normal client disconnect.
During one of the incidents that prompted the investigation, the relay recorded 12 timeouts and a Remote Desktop session dropped around the same time. The cause of that incident remains open. We confirmed the zero-byte read issue separately in the controlled tests.
Could you check how the current Lucera AuthServer and GameServer handle a zero-byte read? If either closes the session, we suggest applying the same fix and adding a regression test in which a message arrives in two parts, with a zero-byte read between them. The expected result is that the session stays open and the complete message is processed once.

While investigating player disconnects during an open beta using the Classic protocol 166 client, we found that both the AuthServer and the GameServer closed the client session when SocketChannel.read() returned 0. We reproduced this behavior in controlled tests against both server binaries.
On a non-blocking TCP connection, a return value of 0 means that no bytes were read during that call. The connection can still be open, and the rest of a message may arrive later. Java reports end-of-stream by returning -1. Java 17 SocketChannel.read() documentation
We updated the selector to keep the session open, preserve any bytes already buffered, and wait for the next read event when a read returns 0. A return value of -1 still closes the session normally. Existing handling for I/O errors and invalid packets remains in place.
After the change, the same test kept the session open on both services. We also verified that direct connections and connections using PROXY protocol v2 could process fragmented input and detect a normal client disconnect.
During one of the incidents that prompted the investigation, the relay recorded 12 timeouts and a Remote Desktop session dropped around the same time. The cause of that incident remains open. We confirmed the zero-byte read issue separately in the controlled tests.
Could you check how the current Lucera AuthServer and GameServer handle a zero-byte read? If either closes the session, we suggest applying the same fix and adding a regression test in which a message arrives in two parts, with a zero-byte read between them. The expected result is that the session stays open and the complete message is processed once.
