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 possible GC upset caused by half-deserialized STables #1436

Merged
merged 1 commit into from Mar 24, 2021

Conversation

niner
Copy link
Contributor

@niner niner commented Feb 20, 2021

While deserializing STables, we may have to deserialize several objects. Doing
so can trigger a garbage collection run. At this point the STable will not be
fully set up yet. E.g. its type_check_cache_length was set but not actually
filled with appropriate objects. This could lead to the GC following invalid
pointers.

Fix by being more careful about setting up data structures hanging off STables
first and only attaching them to the STable once they are fully ready.

While deserializing STables, we may have to deserialize several objects. Doing
so can trigger a garbage collection run. At this point the STable will not be
fully set up yet. E.g. its type_check_cache_length was set but not actually
filled with appropriate objects. This could lead to the GC following invalid
pointers.

Fix by being more careful about setting up data structures hanging off STables
first and only attaching them to the STable once they are fully ready.
@niner
Copy link
Contributor Author

niner commented Feb 20, 2021

I'm not 100 % sure about invocation_spec. What happens, when some of the objects are already deserialized and the pointers written to invocation_spec and a GC gets triggered? Since the invocation_spec itself is not yet attached to the STable, it won't get processed and may then contain outdated pointers. Except that we deserialize into gen2 by default anyway. So deserialized objects won't move. But then I wonder why we need to use MVM_ASSIGN_REF if both the STable and the assigned objects are actually guaranteed to be in gen2.

@niner niner merged commit 13f9262 into master Mar 24, 2021
@Altai-man Altai-man deleted the fix_gc_during_stable_deserialization branch April 24, 2021 14:52
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.

None yet

1 participant