Project

General

Profile

Actions

Bug #20767

closed

VM_ASSERT fails on clear_method_entry_by_id_in_class() under a specific situation

Added by tagomoris (Satoshi Tagomori) about 2 months ago. Updated 17 days ago.

Status:
Closed
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 #1

Updated by tagomoris (Satoshi Tagomori) about 2 months ago

  • ruby -v set to ruby 3.4.0dev (2024-09-27T17:45:22Z vm_assertion_cme_o.. 027ef60500) +PRISM [arm64-darwin23]
Actions #3

Updated by alanwu (Alan Wu) about 1 month ago

  • Status changed from Open to Closed

a838f980f599d95ccf344157f7074e997af31f48 should have fixed this issue.

Actions #4

Updated by alanwu (Alan Wu) 24 days ago · Edited

  • Status changed from Closed to Open
Actions #5

Updated by mame (Yusuke Endoh) 17 days ago

  • Status changed from Open to Closed
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0