-
Notifications
You must be signed in to change notification settings - Fork 86
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allways close chainsync servers reader state #2880
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent.
It's probably a general thing we should clarify in our docs for typed protocols and the network framework etc, and also audit in our existing code:
Do not allocate resources within a protocol handler. Have all resources allocated (with appropriate bracketing) and passed into the protocol handler. Protocol handlers get killed unceremoniously, and the (continuation) style in which they are written does not support resource cleanup.
@@ -41,13 +50,12 @@ chainSyncHeadersServer | |||
) | |||
=> Tracer m (TraceChainSyncServerEvent blk) | |||
-> ChainDB m blk | |||
-> Reader m blk (WithPoint blk (SerialisedHeader blk)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes great, pass the resource in, rather than allocating it within the protocol handler.
bracket | ||
(chainSyncHeaderServerReader (getChainDB kernel) registry) | ||
ChainDB.readerClose |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
a6a6ca7
to
3d66c2e
Compare
-> m (Reader m blk (WithPoint blk (Serialised blk))) | ||
chainSyncBlockServerReader chainDB registry = ChainDB.newReader chainDB registry getSerialisedBlockWithPoint | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you have another reason to update this PR, please also remove these extraneous newlines while you're at it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Removed
@karknu Is this PR ready for merge? I see that Duncan Approved. You said it slowed the leak, so I'm happy to get it in before the upcoming release. I hope to open a PR that supersedes today to also beat the release, but I might lose that race. So let's have your improvement in place ASAP. Thanks. |
(The failing windows CI build does not currently block merge, especially in light of this unrelated diff.) |
3d66c2e
to
1932e92
Compare
Rebased and will merge. |
1932e92
to
39f8d9c
Compare
bors merge |
Build succeeded: |
No description provided.