Files
nest/integration
Kamil MyśliwiecandClaude Opus 5 dee4ed4dbc fix(microservices): harden the tcp transport against a hostile peer
Backport of the shutdown and memory-bound fixes from 12.x.

"ServerTCP#close" only called "net.Server#close", which stops the server
from accepting new connections but leaves established ones untouched. A
connection opened before the shutdown therefore survived it: the process
was kept alive by the dangling socket long after "app.close()" resolved,
and messages arriving on that connection were still dispatched to message
handlers. Accepted sockets are now tracked and destroyed when the server
closes.

Two further paths let a single peer grow the process heap without limit.
A peer could declare a packet length, send part of the payload and then
go silent, and nothing ever reaped the connection. On the sending side
the return value of "socket.write" was discarded, so a peer that issued
requests without reading the responses made the process queue every
response in memory.

An idle timer now drops a peer that stops sending mid-packet. It is
refreshed on every read, so a slow but progressing transfer is never
interrupted and a peer sitting idle between packets is left alone.
Reading is suspended while a peer's outgoing buffer is backed up, and
responses queued for a peer that reads nothing are capped. Both limits
are configurable on the server and the client through the new
"incompleteMessageTimeout" and "maxSendBufferSize" options, and either
can be turned off by setting it to 0.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-09-14 21:30:14 +02:00
..
2025-01-09 11:54:46 +01:00
2026-05-21 20:43:40 +02:00