Skip to content

Conversation

@jolavillette
Copy link
Contributor

Problem

GXS Channels service was experiencing a massive CPU and memory spike at every startup. Thousands of "Unprocessed" items were being reloaded in an infinite loop because they were never successfully acknowledged and persisted as "Processed" in the database.

Root Causes

  1. Partial Processing: [load_unprocessedPosts] was only handling Posts, leaving Comments and Votes in an UNPROCESSED state forever.
  2. Missing Persistence: Status updates were not always flushed to disk immediately, causing them to be lost if the service didn't shut down cleanly.
  3. Filter Bypass Bug: In RsGxsDataAccess::getMsgIdList, if a filter resulted in zero matches, it returned an empty ID set. The lower-level DB layer interpreted an empty set as "fetch everything," effectively bypassing the filter and reloading already-processed items.

Proposed Changes

  • p3GxsChannels:
    • Updated [load_unprocessedPosts] to iterate through Comments and Votes to mark them as processed.
    • Added a forced call to [processMsgMetaChanges()] to ensure immediate DB persistence.
  • RsGxsDataAccess:
    • Fixed the filter bypass by skipping groups with no matching message IDs after filtering.
  • RsGenExchange:
    • Exposed [processMsgMetaChanges()] and [processGrpMetaChanges()] to protected visibility to allow services to force DB synchronization.

Impact

  • Startup is now clean after a one-time migration of pending items.
  • Eliminated redundant DB loads and associated memory/CPU spikes.

@jolavillette jolavillette force-pushed the fix/gxs-startup-reload-spike branch from 0de2ada to 9cce5bb Compare February 9, 2026 07:42
<< " MsgStatus: " << meta->mMsgStatus
<< " MsgId: " << meta->mMsgId << std::endl;
#endif
return true;
Copy link
Contributor

Choose a reason for hiding this comment

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

Why this return? It blocks the checking of other flags below as it did before.

Copy link
Contributor

@csoler csoler left a comment

Choose a reason for hiding this comment

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

good catch. One issue to answer/fix.

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.

2 participants