Skip to content

Commit 6b9bf65

Browse files
fix: memory leak - grpc plugin was accumulating updates endlessly (#305)
this was caused by the bug introduced during solana upgrade, when commitment level for updates was changed to Finalized, but filter in plugin wasn't updated to match that <!-- greptile_comment --> ## Greptile Summary This PR fixes a critical memory leak in the gRPC plugin by correcting the commitment level check for slot messages. - Updates commitment level check from `Processed` to `Finalized` in `magicblock-geyser-plugin/src/grpc.rs` to match current slot behavior - Fixes memory leak caused by accumulating unprocessed slot data due to incorrect commitment level filtering - Improves memory management by enabling proper cleanup of old slot data - Changes empty match arm from `_ => {}` to `_ => ()` for code consistency <!-- /greptile_comment --> Co-authored-by: Gabriele Picco <piccogabriele@gmail.com>
1 parent 1b2da4a commit 6b9bf65

File tree

1 file changed

+4
-4
lines changed
  • magicblock-geyser-plugin/src

1 file changed

+4
-4
lines changed

magicblock-geyser-plugin/src/grpc.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,9 @@ impl GrpcService {
168168
Message::Slot(msg) if processed_first_slot.is_none() && msg.status == CommitmentLevel::Processed => {
169169
processed_first_slot = Some(msg.slot);
170170
}
171-
// NOTE: this used to guard to `CommitmentLevel::Finalized`, but we never
172-
// send that
173-
Message::Slot(msg) if msg.status == CommitmentLevel::Processed => {
171+
// Note: all slots received by plugin are Finalized, as
172+
// we don't have forks or the notion of slot trees
173+
Message::Slot(msg) if msg.status == CommitmentLevel::Finalized => {
174174
// NOTE: originally 10 slots were kept here, but we about 80x as many
175175
// slots/sec
176176
if let Some(msg_slot) = msg.slot.checked_sub(80) {
@@ -220,7 +220,7 @@ impl GrpcService {
220220
}
221221
}
222222
}
223-
_ => {}
223+
_ => ()
224224
}
225225

226226
// Update block reconstruction info

0 commit comments

Comments
 (0)