Skip to content

Fix #4162: start notifiers in goroutine with retry to avoid BBolt lock contention#4163

Closed
reinkrul wants to merge 1 commit intoV5.4from
fix/4162-notifier-startup-retry
Closed

Fix #4162: start notifiers in goroutine with retry to avoid BBolt lock contention#4163
reinkrul wants to merge 1 commit intoV5.4from
fix/4162-notifier-startup-retry

Conversation

@reinkrul
Copy link
Copy Markdown
Member

@reinkrul reinkrul commented Apr 9, 2026

Summary

Partial fix for #4162

  • connectToKnownNodes() triggers transaction syncing from peers, which holds the BBolt write lock
  • notifier.Run() needs a read lock and times out, causing Start() to return an error and the node to shut down
  • Fix: run notifiers in a background goroutine (startNotifiers) that retries any failed notifier every 30 seconds until all have started successfully

Test plan

  • TestNetwork_startNotifiers/ok_-_succeeds_on_first_try: notifier starts on the first attempt
  • TestNetwork_startNotifiers/ok_-_retries_on_first_failure: notifier fails once, is retried, and succeeds

🤖 Generated with Claude Code

…k contention

connectToKnownNodes() may already be syncing transactions from peers when
notifier.Run() is called, holding the BBolt write lock and causing read lock
timeouts. Run notifiers in a background goroutine that retries failed notifiers
every 30 seconds until all have started successfully.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@qltysh
Copy link
Copy Markdown

qltysh bot commented Apr 9, 2026

Qlty

Coverage Impact

⬇️ Merging this pull request will decrease total coverage on V5.4 by 0.02%.

Modified Files with Diff Coverage (1)

RatingFile% DiffUncovered Line #s
Coverage rating: B Coverage rating: B
network/network.go100.0%
Total100.0%
🚦 See full report on Qlty Cloud »

🛟 Help
  • Diff Coverage: Coverage for added or modified lines of code (excludes deleted files). Learn more.

  • Total Coverage: Coverage for the whole repository, calculated as the sum of all File Coverage. Learn more.

  • File Coverage: Covered Lines divided by Covered Lines plus Missed Lines. (Excludes non-executable lines including blank lines and comments.)

    • Indirect Changes: Changes to File Coverage for files that were not modified in this PR. Learn more.

@reinkrul
Copy link
Copy Markdown
Member Author

We chose to solve it using #4170

@reinkrul reinkrul closed this Apr 10, 2026
@reinkrul reinkrul deleted the fix/4162-notifier-startup-retry branch April 10, 2026 14:14
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