Skip to content

Memory: StreamWriter uses an unbounded packet queue per client #38

Description

@Tonguechaude

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingoptimizationSomething could be tuned up or optimized

    Type

    Fields

    No fields configured for Bug.

    Projects

    Status
    TBD

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions