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

Fix stack overflow by adding a missing bang #479

Merged
merged 1 commit into from
Dec 11, 2019

Conversation

mrBliss
Copy link
Contributor

@mrBliss mrBliss commented Dec 11, 2019

The local qProc function in Cardano.BM.Backend.Switchboard loops by
calling itself recursively, passing in the same MVar MessageCounter each
time. However, MessageCounter was missing a bang on its mcCountersMap
field, which contains HM.HashMap Text Word64. Even though the HashMap is a
strict one, if you don't force it, you're still accumulating thunks. And as
the MVar containing the MessageCounter was passed recursively, this
resulted in a stack overflow instead of running out of (heap) memory.

Fix it by adding the missing bang.

This should fix IntersectMBO/cardano-node#370.

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.

LGTM.

Copy link
Contributor

@CodiePP CodiePP left a comment

Choose a reason for hiding this comment

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

thanks.

@mrBliss
Copy link
Contributor Author

mrBliss commented Dec 11, 2019

bors r+

@iohk-bors
Copy link
Contributor

iohk-bors bot commented Dec 11, 2019

🔒 Permission denied

Existing reviewers: click here to make mrBliss a reviewer

@dcoutts
Copy link
Contributor

dcoutts commented Dec 11, 2019

bors r+

iohk-bors bot added a commit that referenced this pull request Dec 11, 2019
479: Fix stack overflow by adding a missing bang r=dcoutts a=mrBliss

The local `qProc` function in `Cardano.BM.Backend.Switchboard` loops by
calling itself recursively, passing in the same `MVar MessageCounter` each
time. However, `MessageCounter` was missing a bang on its `mcCountersMap`
field, which contains `HM.HashMap Text Word64`. Even though the `HashMap` is a
strict one, if you don't force it, you're still accumulating thunks. And as
the `MVar` containing the `MessageCounter` was passed recursively, this
resulted in a stack overflow instead of running out of (heap) memory.

Fix it by adding the missing bang.

This should fix IntersectMBO/cardano-node#370.

Co-authored-by: Thomas Winant <[email protected]>
@CodiePP
Copy link
Contributor

CodiePP commented Dec 11, 2019

bors r+

iohk-bors bot added a commit that referenced this pull request Dec 11, 2019
479: Fix stack overflow by adding a missing bang r=CodiePP a=mrBliss

The local `qProc` function in `Cardano.BM.Backend.Switchboard` loops by
calling itself recursively, passing in the same `MVar MessageCounter` each
time. However, `MessageCounter` was missing a bang on its `mcCountersMap`
field, which contains `HM.HashMap Text Word64`. Even though the `HashMap` is a
strict one, if you don't force it, you're still accumulating thunks. And as
the `MVar` containing the `MessageCounter` was passed recursively, this
resulted in a stack overflow instead of running out of (heap) memory.

Fix it by adding the missing bang.

This should fix IntersectMBO/cardano-node#370.

Co-authored-by: Thomas Winant <[email protected]>
The local `qProc` function in `Cardano.BM.Backend.Switchboard` loops by
calling itself recursively, passing in the same `MVar MessageCounter` each
time. However, `MessageCounter` was missing a bang on its `mcCountersMap`
field, which contains `HM.HashMap Text Word64`. Even though the `HashMap` is a
strict one, if you don't force it, you're still accumulating thunks. And as
the `MVar` containing the `MessageCounter` was passed recursively, this
resulted in a stack overflow instead of running out of (heap) memory.

Fix it by adding the missing bang.

This should fix IntersectMBO/cardano-node#370.

Signed-off-by: Alexander Diemand <[email protected]>
@CodiePP CodiePP force-pushed the mrBliss/fix-stack-overflow branch from 327bdf4 to da2001b Compare December 11, 2019 15:40
@CodiePP CodiePP merged commit b310a4f into master Dec 11, 2019
@iohk-bors iohk-bors bot deleted the mrBliss/fix-stack-overflow branch December 11, 2019 16:32
@CodiePP CodiePP added this to the S2 2019-12-19 milestone Dec 20, 2019
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.

Space Leak in deployed nodes
3 participants