You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
net: write() on new net.Socket() before connect() is silently dropped (Node: ERR_SOCKET_CLOSED + destroy) #11156
Writing to a new net.Socket() before calling connect() behaves differently from Node. Node fails the write with ERR_SOCKET_CLOSED, destroys the socket and returns false. Perry accepts the bytes, counts them, and silently drops them: no error, no delivery. A program that relies on that 'error' never sees it, and the socket connects normally afterwards with the data gone.
Perry main (784ed8e) + #11130: write false (the return value is fixed in #11130), then no 'error'. The socket connects and the server receives 0 bytes.
Where: SocketState::command in crates/perry-ext-net/src/lib.rs. While awaiting_connect, a write is "accepted and counted, then dropped" by design, a carry-over from the old per-socket channel. Node's Socket._writeGeneric instead calls this.destroy(new ERR_SOCKET_CLOSED()) when there is no handle and the socket is not connecting.
Found while checking a CodeRabbit comment on #11130. That PR only fixes the write() return value (false) and does not arm 'drain' for these bytes.
Activity