Project

General

Profile

Actions

Bug #20767

open

VM_ASSERT fails on clear_method_entry_by_id_in_class() under a specific situation

Added by tagomoris (Satoshi Tagomori) about 1 month ago. Updated 6 days ago.

Status:
Open
Assignee:
-
Target version:
-
ruby -v:
ruby 3.4.0dev (2024-09-27T17:45:22Z vm_assertion_cme_o.. 027ef60500) +PRISM [arm64-darwin23]
[ruby-dev:<unknown>]

Description

VM_ASSERT in clear_method_entry_by_id_in_class() (vm_method.c) fails when:

  • Kernel#require is refined
  • Kernel#require is replaced by alias_method and define_method
  • User code calls require
  • The aliased method entry is undefined

Under this situation, VM_ASSERT(cme->owner == T_CLASS) fails in clear_method_entry_by_id_in_class.
This CI failure shows it: https://github.com/ruby/ruby/actions/runs/11081754435/job/30793895707?pr=11715

In this case, the cme had:

  • def->type: CFUNC
  • defined_class: Kernel
  • owner: Kernel

I couldn't find the root cause of why Kernel is set on cme->owner, and why the owner is checked here.
How should we fix this problem?

  • Just delete the VM_ASSERT() (because the cme is just to be invalidated)
  • Fix the root cause of the invalid&unexpected cme->owner
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0