googleapis / googleapis/google-cloud-ruby
[multiple clients] Do not reference static or long-lived protobuf message objects from transient protobuf messages
Nessuno ha ancora preso questa issue.
- Lingua principale
- Ruby
- Stelle
- 1.4k
- Fork
- 578
- Merge medio
- 1g 11h
- PR unite (30g)
- 166
Descrizione
There is a known issue in protobuf (https://github.com/protocolbuffers/protobuf/issues/10106) in which if transient message object A references a long-lived message object B, the protobuf data underlying A will not get garbage collected until B is collectable, even if A is not reachable. This is because A and B are forced into the same protobuf arena, which protobuf will not dispose as long as B is live. If many such transient objects A are created, this will present as a memory leak. (Note: this may be a simplification of the exact repro case and explanation; see the original protobuf issue for more details.)
The upshot is, client libraries should not hold onto any protobuf message objects that can be used as field values in other objects that are meant to be transient. A common example could be a "common" value held in a Ruby constant, which is then used as a field value in a client request object—this will cause all such request objects to remain in memory indefinitely, as long as the Ruby constant remains in scope.
Instead, any such common objects should either be created "on the fly" so they can be collected along with the object that references them, or "deep copied" so the copy actually referenced is collectable even if the original is long-lived.
We need to audit all handwritten client libraries and make this change. One known case is in the google-cloud-bigtable client: the Google::Cloud::Bigtable::RowFilter module includes several constants which are proto messages used in filter chains.
References:
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia con le librerie client scritte manualmente, in particolare il modulo Google::Cloud::Bigtable::RowFilter e le relative protobuf message constants. Verifica i valori dei campi utilizzati negli oggetti transitori di request o filtro, quindi accertati che gli oggetti protobuf di lunga durata non vengano conservati; il lavoro è completato quando le librerie client identificate non mantengono più in vita dati protobuf transitori tramite costanti condivise.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- ruby
- Ambito
- api
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100