Skip to content

unbounded memory in streamable transport #190

@jba

Description

@jba

In the current implementation of the streamable HTTP transport, the server can consume unbounded memory.

  1. stream.outgoing is a slice of messages ready to send. But they may be sent very slowly if the client connection is slow. What's worse, if the client never does a non-replay GET (and the spec says that it doesn't have to), then messages for stream 0 will never be sent.

  2. Since a stream can always be replayed, even after the response to a request is sent, data structures for the stream are kept forever.

For (1) and POST requests, we should bound the outgoing queue to exert backpressure on the server.

For (1) and the non-replay GET, bounding the queue will just lead to deadlock if the GET never arrives. However, dropping messages that are sent prior to receiving the GET is also wrong: it will cause a race condition where the server might send a message on a session just as it's established and before the client can make the GET request. One solution is to use a circular queue and drop old messages. These messages should be notifications for the most part (feature-changed, logging) so dropping them doesn't matter. If the server were to make requests outside of a client request, dropping those would be more problematic.

Metadata

Metadata

Labels

bugSomething isn't workingrelease blockerThis issue blocks the release milestone with which it is associated.

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions