fix: Subscription stream resource leak#2279
Conversation
|
Is the core problem not that we allow such requests at all? For example, even with this fix, we still allow a client to submit with |
Yea I was thinking that we should probably allow some reasonable upper limit like current tip + 100 blocks. Just in case the flexibility is beneficial for any reason in the future? Otherwise yes, the alternative is to reject any such requests in the first place. LMK What you prefer. |
What I want to avoid is logic like this PR where there are multiple "hidden" branch layers to cater for random edge case fixes. So I think lets rather reject if its not within a small margin of the current tip e.g. like 10 blocks. |
Problem
A subscription stream client can connect with a starting block greater than the node's current tip. If that client disconnects, the resources reserved for that client are only cleaned up when the node's current tip reaches the starting block specified by the client. Clients can thereby cause resource leaks with malicious requests.
Solution
Whenever the node's current tip changes, also check for client disconnection. Release associated resources if client has disconnected at this point.
Changelog