Skip to content

Conversation

@vlntb
Copy link
Collaborator

@vlntb vlntb commented Mar 20, 2025

High Level Overview of Change

  • In-memory cache is split between multiple instances of TaggedCache (i.e. LedgerHistory, TreeNodeCache, AcceptedLedgerCache and a few more).
  • There is no synchronisation between the parts of the in-memory cache during the sweep.
  • The cached item expiry time depends on the cache size and its relation to the cache target size. As a result, instances of TaggedCache can have different expiry thresholds.
  • The Missing Node: State Tree error manifests itself in the following sequence of events:
  1. processLedgerRequest triggers getLedger, which checks LedgerHistory
  2. The logic that follows then assumes that if the ledger is present in the LedgerHistory, then ledger contents is also preserved in the other cache - TreeNodeCache.
  3. However, since the expiry for the TreeNodeCache can be calculated differently, it could have been already removed from memory by the sweep function.

p.s. Ordering in the Application::doSweep is done correctly in this case (first TreeNodeCache, second - LedgerHistory), but this does not help because of the difference in the sweep expiry time.

The change

Change the Log level to warning and monitor its frequency. If we start seeing frequent occurrences of this event, this might indicate that the target age should be increased.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Refactor (non-breaking change that only restructures code)
  • Performance (increase or change in throughput and/or latency)
  • Tests (you added tests for code that already exists, or your new feature included in this PR)
  • Documentation update
  • Chore (no impact to binary, e.g. .gitignore, formatting, dropping support for older tooling)
  • Release

API Impact

  • Public API: New feature (new methods and/or new fields)
  • Public API: Breaking change (in general, breaking changes should only impact the next api_version)
  • libxrpl change (any change that may affect libxrpl or dependents of libxrpl)
  • Peer protocol change (must be backward compatible or bump the peer protocol version)

@codecov
Copy link

codecov bot commented Mar 20, 2025

Codecov Report

Attention: Patch coverage is 77.77778% with 2 lines in your changes missing coverage. Please review.

Project coverage is 78.1%. Comparing base (67028d6) to head (ecbd48a).
Report is 42 commits behind head on develop.

Files with missing lines Patch % Lines
include/xrpl/basics/TaggedCache.h 87.5% 1 Missing ⚠️
src/xrpld/overlay/detail/PeerImp.cpp 0.0% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff            @@
##           develop   #5359     +/-   ##
=========================================
- Coverage     78.1%   78.1%   -0.0%     
=========================================
  Files          790     790             
  Lines        67990   67988      -2     
  Branches      8253    8255      +2     
=========================================
- Hits         53092   53086      -6     
- Misses       14898   14902      +4     
Files with missing lines Coverage Δ
include/xrpl/basics/TaggedCache.h 87.2% <87.5%> (ø)
src/xrpld/overlay/detail/PeerImp.cpp 3.8% <0.0%> (ø)

... and 6 files with indirect coverage changes

Impacted file tree graph

🚀 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.

@vlntb vlntb marked this pull request as ready for review March 25, 2025 14:29
@vlntb vlntb changed the title change to warning + cosmetic changes getNodeFat Missing Node State Tree exception: change to warning + cosmetic changes Mar 25, 2025
@vlntb vlntb requested a review from ximinez April 15, 2025 11:25

clock_type::time_point const now(m_clock.now());
clock_type::time_point when_expire;
clock_type::time_point expire_before_this;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you only rename this without changing how it's used? Could you add a comment here explaining how it's used / what it means?

@vlntb
Copy link
Collaborator Author

vlntb commented May 28, 2025

We have plans to remove expiration logic from the TaggedCache, which makes this renaming obsolete. I will close this PR and re-open it a new one with the one line change related to getNodeFat.

@vlntb vlntb closed this May 28, 2025
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.

3 participants