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

Release a RefTracker even if the corresponding finaliser threw an error #513

Merged
merged 2 commits into from
Jan 7, 2025

Conversation

jorisdral
Copy link
Collaborator

In debug mode if the finaliser of a reference counted object throws an error, then the RefTracker is never released. checkForgottenRefs will then report the reference as forgotten, even though the finaliser ran, though not successfully. This PR ensures that the RefTracker is released even if the finaliser throw an error. This improves the experience of debugging finalisers that fail.

In debug mode if the finaliser of a reference counted object throws an error,
then the `RefTracker` is never released. `checkForgottenRefs` will then report
the reference as forgotten, even though the finaliser ran, though not
successfully. The test that is added in this commit indeed shows this is the
case. The next commit fixes the issue, which should improve the experience of
debugging finalisers that fail.
@jorisdral jorisdral self-assigned this Dec 30, 2024
@jorisdral jorisdral force-pushed the jdral/release-reftracker-exception branch 2 times, most recently from c43a654 to 0c8bac8 Compare December 30, 2024 15:37
src-control/Control/RefCount.hs Outdated Show resolved Hide resolved
@jorisdral jorisdral force-pushed the jdral/release-reftracker-exception branch from 0c8bac8 to 2880e5e Compare January 7, 2025 16:27
@jorisdral jorisdral enabled auto-merge January 7, 2025 16:28
@jorisdral jorisdral added this pull request to the merge queue Jan 7, 2025
Merged via the queue into main with commit 0c74e7a Jan 7, 2025
27 checks passed
@jorisdral jorisdral deleted the jdral/release-reftracker-exception branch January 7, 2025 18:19
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