Ruby 2.7: Understand and debug problems with heap compaction
Apr 28, 2021Matthias Käppler10 min read
Opens about.gitlab.comWhat the post covers
This post details the investigation and resolution of a production incident caused by Ruby 2.7's heap compaction feature when used with Puma's 'nakayoshi_fork'.
- It explains the concepts of tenuring objects and heap compaction, the challenges encountered with C-extensions like Hamlit due to improper object marking, and the specific fix implemented in Hamlit to resolve segfaults by statically resolving constants and using `rb_gc_register_mark_object`.
- It also highlights the need for more reliable detection of compaction-related issues in CI.




