Skip to content

fix: manage frequency startup to avoid race conditions#209

Closed
hwahby wants to merge 7 commits intomainfrom
fix/startup-racecondition-freq
Closed

fix: manage frequency startup to avoid race conditions#209
hwahby wants to merge 7 commits intomainfrom
fix/startup-racecondition-freq

Conversation

@hwahby
Copy link
Contributor

@hwahby hwahby commented Oct 16, 2025

Purpose

The goal of this PR is to fix errors caused by ensuring the local frequency node, a dependency of SAT, if selected starts before other services are initialized.

Closes #175

Solution

Migrate start-up logic fixes from Gateway into Social App Template

Change summary

  • Wrap startup logic in functions matching Gateway, to allow sequencing and parsing of arguments
  • Include logic waiting for Frequency node to start before starting other services
  • I noticed a recurring error locally { Module: { index: '60', error: "0x00000000' } } around the default Frequency provider already existing. Error handling has been added to help the startup look cleaner.

Steps to Verify

  1. Run ./start.sh and /stop.sh scripts to confirm they are still working

Additional details / screenshot

Waiting for local frequency node to start:

Screenshot 2025-10-15 at 4 31 35 PM

Start remaining services, new logging/error handling around provider creation:

Screenshot 2025-10-15 at 4 25 55 PM Screenshot 2025-11-04 at 1 53 05 PM

Checklist

  • Code complete

@mattheworris
Copy link
Contributor

  • Read through current changes, looking good.
  • May want to consider adding the bats tests for start.sh and bash_functions.sh as per gateway: test_start.bats and in CI here: build.yml

events.map((x) => x.toHuman())
);
reject();
console.log('INFO: MSA transaction completed (possibly already exists)');
Copy link
Contributor

Choose a reason for hiding this comment

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

Under what circumstances would we NOT get an "MSA already exists" dispatch error, but a failed extrinsic could still fail due to the MSA already existing?

Comment on lines +64 to +65
if (errorDetails.Module && errorDetails.Module.index === '60') {
console.log('INFO: Provider may already exist for Alice, continuing...');
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe there's a specific error we can check for here

@hwahby hwahby marked this pull request as ready for review November 4, 2025 21:47
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.

Fix Startup Race conditions when using local frequency node

4 participants