Skip to content
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

Memory leak in networking code #1902

Merged
merged 9 commits into from
Apr 8, 2020
Merged

Memory leak in networking code #1902

merged 9 commits into from
Apr 8, 2020

Conversation

coot
Copy link
Contributor

@coot coot commented Apr 3, 2020

No description provided.

@coot coot changed the title Memory leak in networking code WIP: Memory leak in networking code Apr 3, 2020
@coot coot force-pushed the coot/network-memory-leak branch from d336690 to b9a62de Compare April 4, 2020 10:37
@coot coot force-pushed the coot/network-memory-leak branch from b9a62de to b3ccb1f Compare April 7, 2020 19:49
@coot
Copy link
Contributor Author

coot commented Apr 7, 2020

Requires: IntersectMBO/cardano-base#89
Is requirement for: IntersectMBO/cardano-node#762

Copy link
Contributor

@dcoutts dcoutts left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good.

One comment below. Plus we can actually avoid changing cardano-base.

@@ -72,17 +73,17 @@ socketAsMuxBearer sduTimeout_m tracer sd =
Nothing -> do
traceWith tracer $ Mx.MuxTraceSDUReadTimeoutException
throwM $ Mx.MuxError Mx.MuxSDUReadTimeout "Mux SDU Timeout" callStack
Just r -> return r
Just !r -> return r
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is a bit odd. It's a bang pattern on a pair right? It's the result of recvRem so we should add strictness there instead.

Do it on the two components of the result pair (header {Mx.msBlob = blob}, ts).

!ts <- getMonotonicTime 

and

let !header' = header {Mx.msBlob = blob}
return (header', ts)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pushed a patch to implement this suggestion.

@dcoutts dcoutts force-pushed the coot/network-memory-leak branch from d59b2a7 to bf45bd7 Compare April 8, 2020 17:24
Bang things nearer their construction site, and don't bang pairs.
@dcoutts
Copy link
Contributor

dcoutts commented Apr 8, 2020

Plus we can actually avoid changing cardano-base.

I've dropped the changes that needed this and did it in a way that didn't need them.

@dcoutts
Copy link
Contributor

dcoutts commented Apr 8, 2020

bors merge

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Apr 8, 2020

@iohk-bors iohk-bors bot merged commit 5837c63 into master Apr 8, 2020
@iohk-bors iohk-bors bot deleted the coot/network-memory-leak branch April 8, 2020 18:07
@coot coot changed the title WIP: Memory leak in networking code Memory leak in networking code Apr 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants