1 suggestion
Earlier concerns neither republished nor resolved: 1 suggestion. See the Run archive for their assessments.
Optional improvements
[suggestion] · An urgent pointer ahead of received data can keep select() reporting an exception
On macOS/BSD, a crafted TCP peer can keep the net thread waking without readable data; the production impact is unconfirmed, and the base behavior has an easier trigger.
Location: src/netbase.cpp:573 (head).
Details and suggested fix
On non-Linux builds, Sock::WaitMany puts sockets waiting to receive into select()'s exception set. When an exception is reported, SocketHandlerConnected calls Recv(). On FreeBSD and XNU, the exception state follows the receive-side urgent mark, which tcp_input sets from the urgent pointer whether or not SO_OOBINLINE is enabled. The option determines whether the urgent byte stays in the normal stream. Once that byte arrives, reading it inline clears the mark, fixing the common case.
TCP also allows the urgent pointer to point up to 64 KiB beyond the data in a segment. A peer that crafts segments, using a raw socket or userspace TCP stack, can send a small payload with the pointer ahead and withhold the bytes up to it. It can also keep advancing the pointer with each segment. In that case, select() continues reporting an exception while Recv() returns WSAEWOULDBLOCK; the peer remains connected, and the net thread loops without its 50 ms wait. Peer servicing continues, but the loop adds CPU use and lock traffic. This behavior is established by FreeBSD/XNU source, but it was not confirmed on a running macOS or FreeBSD host, and no concrete production trigger or affected caller was identified. The open question is whether this overhead materially degrades a node; the base has the same behavior with an easier trigger.
A fix covering these cases is to add sockets to the exception set only on WIN32. #36665 describes that set as necessary to detect failed connection attempts early on Windows. With SO_OOBINLINE, Windows reports inline OOB data as readable rather than exceptional, and POSIX ConnectToSocket already detects failed connections through readiness plus SO_ERROR. If that change is out of scope, narrow the comment to say it covers urgent data that has arrived.
Earlier concerns
Earlier reports raised these, with the titles and severities shown there. This review neither republished nor resolved them.
- [suggestion]: Urgent-data test does not check that the pending state clears (earlier report)