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 finalization after failure #161

Merged
merged 2 commits into from
Aug 24, 2018

Conversation

natefaubion
Copy link
Collaborator

It appears to have only worked coincidentally before. When the
interpreter enters into a finalization block, it puts a Finalized node
onto the attempt stack with the current step. However if there was
a failure, then step would be null. It "worked" before because there was
stale state, and fail could be preserved through finalization. This
bug was exposed by using catchError within the finalization block,
which resets the failure state to null. Thus when it resumes after
finalization, both step and fail are null, which is an invalid
state. The solution is to preserve fail in addition to step in
a Finalized node.

Fixes #159

It appears to have only worked coincidentaly before. When the
interpreter enters into a finalization block, it puts a `Finalized` node
onto the attempt stack with the current `step`. However if there was
a failure, then step would be null. It "worked" before because there was
stale state, and `fail` could be preserved through finalization. This
bug was exposed by using `catchError` within the finalization block,
which resets the failure state to null. Thus when it resumes after
finalization, both `step` and `fail` are null, which is an invalid
state. The solution is to preserve `fail` in addition to `step` in
a `Finalized` node.
@natefaubion
Copy link
Collaborator Author

@felixSchl Can you confirm this fixes your issue?

I have a suspicion that there are other bugs caused by this sort of state falling through, but I can merge this and investigate that in a follow up PR.

@felixSchl
Copy link

Hey, sorry for the delay. It does indeed appear to fix the problem 👍

@natefaubion natefaubion merged commit 5450756 into purescript-contrib:master Aug 24, 2018
@natefaubion natefaubion deleted the fix-bracket-catch branch August 24, 2018 03:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants