multi: bound peer message subscriptions - #11159
moscowchill wants to merge 2 commits into
Conversation
Custom-message and onion-message RPC clients currently use unbounded per-client queues. A stalled stream can retain peer-controlled messages without limit. Add opt-in bounded queues, evict slow clients with ResourceExhausted, drain their backlog, and preserve legacy behavior for other subscription users. Signed-off-by: moscowchill <gasgeverij@proton.me>
Signed-off-by: moscowchill <gasgeverij@proton.me>
🔴 PR Severity: CRITICAL
🔴 Critical (2 files)
🟡 Medium (1 file)
🟢 Low (3 files)
AnalysisThe PR modifies To override, add a |
|
Thanks for the PR, @moscowchill. Our contribution guidelines note that PRs from new contributors aren't prioritized for review at the moment. With the backlog we have, that means closing this instead of leaving it in limbo. If you hit an actual failure that motivated this change, an issue with the reproduction details (lnd version, backend, logs, expected vs. observed behavior) would be much more useful to us than the patch on its own. We'll triage it from there. If you'd like to contribute going forward, reviewing open PRs and helping triage issues is the path we recommend. It's a stronger signal of understanding than a first patch, and it makes it a lot easier for us to prioritize your PRs later. Thanks for understanding. |
Change Description
Custom-message and onion-message RPC subscribers currently use an unbounded per-client queue. If a stream stops accepting responses while peer messages continue to arrive, its queue retains those messages without a memory limit.
This PR adds an opt-in bounded mode to the subscription server and uses it for both peer-message RPCs. Each client may retain 100 pending messages, which limits maximum-sized queued payloads to less than 6.3 MiB. A client that exceeds the limit is removed and its queued references are drained immediately; healthy clients continue receiving ordered updates without producer blocking.
Slow-consumer eviction is reported as gRPC
ResourceExhaustedonce the stream can make transport progress. Existing users ofsubscribe.NewServer()keep their current queue behavior.Steps to Test
Pull Request Checklist
Testing
Code Style and Documentation