Skip to content

fix(rpc): allow node startup retry after listener failure - #1494

Merged
lklimek merged 1 commit into
v1.8-devfrom
fix/async-broadcast-start-retry
Sep 22, 2026
Merged

lklimek merged 1 commit into
v1.8-devfrom
fix/async-broadcast-start-retry

Conversation

@lklimek

@lklimek lklimek commented Sep 21, 2026 •

Copy link
Copy Markdown
Collaborator

Nodes embedded in an application can retry startup after an RPC listener fails to bind, without recreating the node instance.

User story

As an application embedding Tenderdash, I want to retry startup after freeing a conflicting RPC port.

Scenario

The first Start fails because the RPC port is occupied. After freeing it, another Start on the same node should succeed. Previously, async admission rejected the retry as already started; after that was corrected, the existing event-log subscription also blocked the retry.

Issue being fixed or feature implemented

Follow-up to merged #1478 and its startup retry review finding. This affects explicit retries on the same node instance; the normal CLI does not retry startup.

What was done?

  • Allow admission to start again only after all prior admitted work has drained, retaining the canceled context for post-stop requests.
  • Capture each stop's semaphore and reset its startup marker only if that instance is still current, preventing stale concurrent stops from clearing a restarted instance.
  • On RPC startup failure, cancel that attempt, close opened listeners, and wait for event-log subscription cleanup before returning.
  • Add regression coverage for an occupied first or second RPC listener, incomplete drain, and a delayed stop completing after restart.

How Has This Been Tested?

The node regression failed on the merged base with async broadcasts already started. Final focused tests passed with the race detector and deadlock tag:

go test -race -tags=deadlock -p 1 ./internal/rpc/core ./node -run 'TestAsyncBroadcast|TestBroadcastTxAsync|TestNodeStartRetryAfterRPCListenFailure|TestNodeStartStop|TestNodeAsyncBroadcastLifecycleWithoutListener' -count=1 -timeout=120s

gofmt, git diff --check, and focused golangci-lint v2.13.2 passed (zero issues). Full CI remains to run.

Breaking Changes

None.

Checklist

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation (implementation comments; no configuration changes)

For repository code-owners and collaborators only

  • I have assigned this pull request to a milestone

🤖 Co-authored by Claudius the Magnificent AI Agent

PR Hygiene · fb778b0

  • Bots — thepastaclaw skipped after the window
  • Self-review — posted; again after any push
  • Within your 5 open PRs
  • Build green
  • Approvals — you own every area touched; none needed

When every box is checked the PR Hygiene check passes and this can merge.

Reset async admission only after draining its jobs and guard against stale concurrent stops. Roll back RPC listeners and the event-log subscription on startup failure so a retry can use the same node instance.

Co-Authored-By: Codex <[email protected]>

<sub>🤖 Co-authored by [Claudius the Magnificent](https://github.com/lklimek/claudius) AI Agent</sub>
@coderabbitai

coderabbitai Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository: dashpay/tenderdash/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: cc719d98-8966-4386-aed8-d8de779f8f84

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@thepastaclaw

thepastaclaw commented Sep 21, 2026 •

Copy link
Copy Markdown

⚠️ DEGRADED — Queued for automated review — 22nd in line, estimated start in ~20 h (commit fb778b0)
Estimated review time once started: ~1.9 h (two-phase automated review; median of recent runs).
The primary review models are currently out of quota; this review will run on stand-in models and be marked as degraded.

  • Request priority review — click to move this review to the front of the queue.

@lklimek
lklimek marked this pull request as ready for review September 22, 2026 08:21
@github-actions

Copy link
Copy Markdown

Bots are done — your move: post /self-reviewed.
Full checklist in the description.

@github-actions github-actions Bot added waiting-self-review Waiting for the author to post /self-reviewed bot-review-skipped A required review bot did not report; it was skipped by the window or by a person. labels Sep 22, 2026
@lklimek

lklimek commented Sep 22, 2026

Copy link
Copy Markdown
Collaborator Author

/self-reviewed

@lklimek
lklimek enabled auto-merge (squash) September 22, 2026 08:23
@github-actions

Copy link
Copy Markdown

Policy satisfied — this can merge.
Full checklist in the description.

@github-actions github-actions Bot removed the waiting-self-review Waiting for the author to post /self-reviewed label Sep 22, 2026
@lklimek
lklimek merged commit 0266595 into v1.8-dev Sep 22, 2026
21 checks passed
@lklimek
lklimek deleted the fix/async-broadcast-start-retry branch September 22, 2026 08:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bot-review-skipped A required review bot did not report; it was skipped by the window or by a person.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants