Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(rpc)!: read from substream while streaming to check for interrupt…
…ions (#3548) Description --- - fixes issue where long running streams continue long after client has dropped the stream - detects stream interruptions on server side and ends the RPC stream - (breaking change) send client protocol message back to explicitly end the stream - check for shutdown signal termination in client side while reading the stream Motivation and Context --- Streams should terminate as soon as they are not used, this was a particular problem when streaming UTXOs to wallets and pruned nodes, when erroring out and retrying, new streams would be established while the old streams still continued until termination. The main trick was to read from the yamux stream just before writing to it without blocking if there was nothing there. This allows yamux to receive the close stream message. How Has This Been Tested? --- New unit test Manually, added code to forcefully error out of pruned sync after starting the stream. The node had another local node as a forced_sync_peer and so would continuously retry that peer. This caused many (saw up to 30) RPC sessions to accumulate and many concurrent streams. With these changes, the sessions used go between 1 and 0 for that peer.
- Loading branch information
Showing
5 changed files
with
135 additions
and
13 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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