Problem
StreamWriter holds a tokio::sync::mpsc::unbounded_channel for outgoing packets. Since this queue has no capacity limit, a client that reads slowly (laggy network, client freeze, slow loris) will cause the server to accumulate
Vec<u8> packet buffers indefinitely, one per encoded frame, with no backpressure and no eviction.
Under normal load this is invisible. Under load spikes (many particles, chunk sends, entity updates), a handful of slow clients can push RSS into the gigabyte range.
Expected behaviour
The server should apply backpressure or drop the connection (like limbo in hypixel) when a client cannot drain its outbound queue fast enough, rather than growing RAM without bound.
Notes
- The queue sits in
src/net/runtime/src/connection.rs inside StreamWriter::new
- Each
Vec<u8> in the queue is a compressed, encrypted packet ready to send, no further sharing, pure allocation pressure
- The issue is independent of game logic. It can be reproduced by throttling a client's TCP receive window
Problem
StreamWriterholds atokio::sync::mpsc::unbounded_channelfor outgoing packets. Since this queue has no capacity limit, a client that reads slowly (laggy network, client freeze, slow loris) will cause the server to accumulateVec<u8>packet buffers indefinitely, one per encoded frame, with no backpressure and no eviction.Under normal load this is invisible. Under load spikes (many particles, chunk sends, entity updates), a handful of slow clients can push RSS into the gigabyte range.
Expected behaviour
The server should apply backpressure or drop the connection (like limbo in hypixel) when a client cannot drain its outbound queue fast enough, rather than growing RAM without bound.
Notes
src/net/runtime/src/connection.rsinsideStreamWriter::newVec<u8>in the queue is a compressed, encrypted packet ready to send, no further sharing, pure allocation pressure