duesee / duesee/imap-next

How to implement backpressure on imap-flow?

Open
#98 1 comment 2 reactions 2 assignees Claimed by @jakoschiko View on GitHub
Dominant language
Rust
Stars
22
Forks
5
PR merge metrics
No merged PRs in 30d

Description

TCP/IP is great as if you don't read the socket, once the TCP OS buffer will be full, the information will be back-propagated through the network to the client, that will slow-down its sending. Unfortunately, we break the "backpressure-chain" as, to send data on imap-flow, you also have to read them, and thus either store it or drop it.

My current workaround is closing the socket if the client sends 10 commands in a row. But it's not ideal, and still can lead to DoS: if we consider 25MB literals, with 10 commands, it's 250MB of memory that can be allocated. Doing that in 10 or 100 of connections, and you can easily trigger an OOM on the server.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.