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 gc/readweakvaltable races #23

Merged
merged 1 commit into from
Sep 27, 2018
Merged

Fix gc/readweakvaltable races #23

merged 1 commit into from
Sep 27, 2018

Conversation

Khatskevich
Copy link
Contributor

Even though the possibility of the bug is low, we are facing it pretty frequently in tarantool/graphql tests.

Copy link
Owner

@pygy pygy left a comment

Choose a reason for hiding this comment

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

Wow, good catch :-)

One nit to pick and we're good.

pkind = typ,
pattern = pt
}
cache[pt.id] = res_pt
Copy link
Owner

Choose a reason for hiding this comment

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

You forgot to change return cache[pt.id] to return res_pt as you did above and below.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

The following pattern leads to wrong behavior.
```
weakvaltable[a] = function(val) -- 1
<GC TRIGGERED>
return weakvaltable[a] -- 2
```
In case GC is triggered between lines 1 and 2,
the retval would be equal to `nil`, because there are
no reverences to the value between those lines.

This commit fixes such patterns in the code with help
of intermediate variable.
@pygy pygy merged commit a1b99da into pygy:master Sep 27, 2018
@pygy
Copy link
Owner

pygy commented Sep 27, 2018

Great, thanks!

So that would make v0.1.2 for those who keep tabs...

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