Limit unbounded channel usage

Aperta
#5,855 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Refactoring
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
rust

Direzione di ricerca

Cerca in Forest ogni utilizzo di flume::unbounded, iniziando dal percorso peer-to-peer intorno a handle_gossip_event, e verifica come viene utilizzato ciascun canale quando raggiunge il proprio limite. Controlla anche le impostazioni di clippy. Il lavoro è completato quando ogni utilizzo è giustificato oppure è stato modificato in modo da usare un canale bounded con una costante o un parametro sensato, e l’uso di unbounded è vietato in clippy senza introdurre deadlock.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Type: Task

Summary

During recent memory profiling in Forest, we noticed the channels in the peer-to-peer module tend to be unbounded. This could have led to excessive memory usage.

Image

A likely scenario here is that messages in handle_gossip_event get deserialised and put into the network channel. Get enough of such events and the channels could grow quickly, each holding the deserialised message, leading to high memory usage.

This issue is not exclusive to the p2p layer; we should revisit all of the flume::unbounded in Forest and allow it only when it's justified.

Completion Criteria

  • re-visit flume::unbounded usages in Forest; all of them should be either justified or changed to bounded versions, with either constants or parameters with sane defaults. ⚠️ Important! Usage of these channels should also be revisited - pushing to a channel that is at its limits will block; this could lead to a deadlock.
  • ban the usage of flume::unbounded in the clippy settings

Additional Links & Resources

Lingua principale
Rust
Stelle
700
Fork
201
Merge medio
1g 17h
PR unite (30g)
65

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di ChainSafe/forest

Tutte le issue di ChainSafe/forest

Issue simili

Altre issue su Rust

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.