Skip to content

fix: bound gossipsub history and seen message ids - #338

Closed
cargopete wants to merge 1 commit into
graphops:devfrom
cargopete:pete/bound-gossipsub-memory
Closed

cargopete wants to merge 1 commit into
graphops:devfrom
cargopete:pete/bound-gossipsub-memory

Conversation

@cargopete

Copy link
Copy Markdown
Contributor

Description

Radios grow memory without bound under relay traffic. Two things in the SDK retain every message ever seen: GossipSubParams.history_length is set to 100000, so go-libp2p-pubsub keeps that many heartbeat windows of full messages in its MessageCache, and seen_msg_ids is a HashSet that is only ever inserted into.

This drops the history_length override back to the gossipsub default and replaces the set with SeenMsgIds, a HashSet plus VecDeque capped at 10000 ids with oldest-first eviction. Gossipsub already discards repeats inside its 1800s seen TTL, so the set only has to outlast that window. The field type on GraphcastAgent changes; nothing in graphops reads it outside the SDK.

Verified with two ping-pong radios on 0.7.4. The stock build climbed to ~330MB RSS over a 15h soak and was still going, with the Go heap almost entirely MessageCache. The patched build stayed flat around 100MB for 6h. test_seen_msg_ids_bounded covers the eviction.

Issue link

graphops/subgraph-radio#150

Checklist

  • Are tests up-to-date with the new changes?
  • Are docs up-to-date with the new changes? (Open PR on docs repo if necessary)

@cargopete cargopete closed this Oct 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant