linera-io / linera-protocol

Main repository for the Linera protocol
Apache License 2.0
112 stars 94 forks source link

Replace usages of unbounded channel with bounded channels #2176

Open jvff opened 2 weeks ago

jvff commented 2 weeks ago

Motivation

There are a few places in the code where we use unbounded channels. This may lead to explosive memory usage if the receiver is slower than the senders. Making the channels bounded adds back pressure to the channels, which prevents exceeding a memory limit.

Bounded channels may lead to deadlocks if used in a circular manner. To help find these deadlock potentials, we should have a way to configure the bounds (e.g., during testing) to make the channels have the smallest bound possible.

Proposal

Investigate usages of unbounded channels and replace them with bounded channels.