While attempting to enable GC.auto_compact=true on Shopify/shopify we ran into a crash Try to mark T_NONE object originating in document_body_entry_mark while trying to mark body->self
Because the document body is stored as an ivar on the parse context a reference to it exists in the generic_iv_tbl. When the generic_iv_tbl_ gets compacted objects can get moved around on it and the ivar references will be updated correctly.
But the pointer on the document body body->self that refers to itself will not be updated this pointer will go invalid and cause the crash.
In order to prevent this issue (and similar in future), this PR implements compaction callbacks for all Ruby types defined in the native extension in order to fully support movement and reference updating during GC compaction.
While attempting to enable
GC.auto_compact=true
onShopify/shopify
we ran into a crashTry to mark T_NONE object
originating indocument_body_entry_mark
while trying to markbody->self
The crash can be seen in this buildkite build
Relevant log entries below:
Because the document body is stored as an ivar on the parse context a reference to it exists in the
generic_iv_tbl
. When thegeneric_iv_tbl_
gets compacted objects can get moved around on it and the ivar references will be updated correctly.But the pointer on the document body
body->self
that refers to itself will not be updated this pointer will go invalid and cause the crash.In order to prevent this issue (and similar in future), this PR implements compaction callbacks for all Ruby types defined in the native extension in order to fully support movement and reference updating during GC compaction.