“Buffer.allocUnsafe() also reserves the right to allocate small buffers as sub-arrays of a global pool it keeps lying around for the purpose.”
A Postgres query hung only when its WebSocket frame reached 126 bytes, the first size that needs a 16-bit length field. undici wrote that length through a DataView that assumed a zero offset, so the length landed in Node’s shared buffer pool, where other live buffers sit. The original code chose DataView for performance. Fast and silently corrupting memory is not a tradeoff anyone signed up for.