Skip to content

Conversation

djkazic
Copy link
Contributor

@djkazic djkazic commented Oct 7, 2025

Today, when using lndinit with litd via its built-in gRPC proxy, a peculiar issue can arise.

The root cause of this has to do with how gRPC requests for the StateService RPC are proxied. litd forwards these requests unconditionally regardless of LND's state as a subserver.

Consequently, if LND takes a few moments to startup, then lndinit will spam litd with SubscribeState requests; after all, the gRPC proxy doesn't know where to forward these requests.

Not only does this pollute the logs of litd, it also incurs a measurable CPU cost. Because the wait is a fixed 250 milliseconds, the severity is compounded with the more litd instances you run on a single machine.

This PR introduces a replacement to the fixed 250 ms ticker.

retryDelay is a calculated wait duration fed by the new function nextBackoff, which implements a simple 2x backoff. The maximum wait duration is capped at 10 seconds.

@djkazic djkazic requested a review from Roasbeef October 7, 2025 12:21
@djkazic djkazic self-assigned this Oct 7, 2025
@djkazic djkazic requested a review from JLSchuler99 October 7, 2025 12:21
@ZZiigguurraatt
Copy link

please rebase so I can test with other commits on the main branch

@ZZiigguurraatt
Copy link

image

@ZZiigguurraatt
Copy link

please rebase so I can test with other commits on the main branch

OK, did that here: https://github.com/ZZiigguurraatt/lndinit/tree/backoff-subscribestate

@djkazic djkazic force-pushed the backoff-subscribestate branch from 1abfe05 to bbcd1b6 Compare October 7, 2025 21:02
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