Skip to content

fix: clear manager cache on sync skip#1085

Open
SmaGMan wants to merge 6 commits into
masterfrom
fix/clear-manager-cache-on-sync
Open

fix: clear manager cache on sync skip#1085
SmaGMan wants to merge 6 commits into
masterfrom
fix/clear-manager-cache-on-sync

Conversation

@SmaGMan
Copy link
Copy Markdown
Member

@SmaGMan SmaGMan commented May 19, 2026

On collator state sync node checks if a newer mc state is already received. If so it does not process current mc state update after sync and continue syncing. But collation manager's cache was cleared only after the sync finish. So the cache may grow infinite that may cause OOM.

This update adds the guard that clears blocks from the cache which are not required for queue restore. So even if node syncs slow and receives new blocks faster then perform sync, the cache is invalidated correctly.

Additionally added some hacks to slowdown collator operations for debug purposes:

  • restore queue
  • resume collation
  • do collate

Pull Request Checklist

NODE CONFIGURATION MODEL CHANGES

[Yes]

Added optional params that allow to slowdown collator operations.

node.config

{
  "collator": {
    "slowdown_restore_queue_ms":  60000,
    "slowdown_resume_collation_ms": 60000,
    "slowdown_do_collate_ms": 60000
  }
}

BLOCKCHAIN CONFIGURATION MODEL CHANGES

[None]


COMPATIBILITY

Fully compatible

SPECIAL DEPLOYMENT ACTIONS

[Not Required]


PERFORMANCE IMPACT

[No impact expected]


TESTS

Unit Tests

Covered by:

  • test_cache_gc_on_skipped_sync

Network Tests

[No coverage]

Manual Tests

Manual tests used:

  • deploy 10kk
  • set "slowdown_restore_queue_ms": 100000 on some node and restart it
  • run transfers 5k
  • check that collation manager's cache metrics does not grow > 100
Screenshot 2026-05-26 at 18 03 23

metrics

@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 19, 2026

🧪 Network Tests

To run network tests for this PR, use:

gh workflow run network-tests.yml -f pr_number=1085

Available test options:

  • Run all tests: gh workflow run network-tests.yml -f pr_number=1085
  • Run specific test: gh workflow run network-tests.yml -f pr_number=1085 -f test_selection=ping-pong

Test types: destroyable, ping-pong, one-to-many-internal-messages, fq-deploy, nft-index, persistent-sync

Results will be posted as workflow runs in the Actions tab.

@SmaGMan SmaGMan force-pushed the fix/clear-manager-cache-on-sync branch from 31fdaeb to a643b1c Compare May 19, 2026 10:22
@SmaGMan SmaGMan changed the base branch from master to refactor/cancel-collation May 19, 2026 10:22
@codecov
Copy link
Copy Markdown

codecov Bot commented May 19, 2026

Codecov Report

❌ Patch coverage is 79.48113% with 87 lines in your changes missing coverage. Please review.
✅ Project coverage is 57.69%. Comparing base (b0a5a87) to head (c852267).

Files with missing lines Patch % Lines
collator/src/manager/msgs_queue.rs 76.77% 55 Missing and 7 partials ⚠️
collator/src/manager/sync.rs 80.24% 8 Missing and 8 partials ⚠️
collator/src/manager/blocks_cache.rs 87.67% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1085      +/-   ##
==========================================
+ Coverage   57.57%   57.69%   +0.11%     
==========================================
  Files         464      464              
  Lines       77109    77449     +340     
  Branches    77109    77449     +340     
==========================================
+ Hits        44395    44681     +286     
- Misses      30701    30744      +43     
- Partials     2013     2024      +11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@SmaGMan SmaGMan force-pushed the refactor/cancel-collation branch from 40873e7 to d266b3b Compare May 21, 2026 16:49
@SmaGMan SmaGMan force-pushed the fix/clear-manager-cache-on-sync branch from cf30591 to a37d125 Compare May 21, 2026 18:21
@SmaGMan SmaGMan force-pushed the refactor/cancel-collation branch from d266b3b to 9c7f32e Compare May 21, 2026 22:12
Base automatically changed from refactor/cancel-collation to master May 22, 2026 13:35
@SmaGMan SmaGMan force-pushed the fix/clear-manager-cache-on-sync branch from a37d125 to 69e3707 Compare May 26, 2026 15:11
@SmaGMan SmaGMan force-pushed the fix/clear-manager-cache-on-sync branch from 69e3707 to c852267 Compare May 26, 2026 15:13
@SmaGMan SmaGMan marked this pull request as ready for review May 26, 2026 17:07
@SmaGMan SmaGMan requested review from 0xdeafbeef and Rexagon May 26, 2026 17:07
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