Repository navigation
lndinit: use an exp backoff instead of connectionRetryInterval - #72
Merged
Merged
Conversation
Contributor
|
please rebase so I can test with other commits on the main branch |
Contributor
Contributor
OK, did that here: https://github.com/ZZiigguurraatt/lndinit/tree/backoff-subscribestate |
djkazic
force-pushed
the
backoff-subscribestate
branch
from
October 7, 2025 21:02
1abfe05 to
bbcd1b6
Compare
Contributor
|
OK, I've fixed all the issues I was having that would trigger this, so I'm not really able to further test this PR, but it was working okay for me as I was tracing down the trigger issues. So, I think it is probably good enough to merge. |
JLSchuler99
approved these changes
Oct 8, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Today, when using
lndinitwithlitdvia 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.
litdforwards these requests unconditionally regardless of LND's state as a subserver.Because
lndinitdetermines readiness by the state of the connection, this means that as soon as a valid gRPC connection exists, it will try to subscribe to LND's state. This is problematic for several reasons.LND takes a few moments to startup, so
lndinitwill spamlitdwithSubscribeStaterequests; 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 morelitdinstances you run on a single machine.This PR introduces a replacement to the fixed 250 ms ticker.
retryDelayis a calculated wait duration fed by the new functionnextBackoff, which implements a simple 2x backoff. The maximum wait duration is capped at 10 seconds.