Bug #20767
closedVM_ASSERT fails on clear_method_entry_by_id_in_class() under a specific situation
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
anddefine_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
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]
Updated by nobu (Nobuyoshi Nakada) about 2 months ago · Edited
The test case: https://github.com/ruby/ruby/pull/11715/files
Updated by alanwu (Alan Wu) 30 days ago
- Status changed from Open to Closed
a838f980f599d95ccf344157f7074e997af31f48 should have fixed this issue.
Updated by alanwu (Alan Wu) 23 days ago · Edited
- Status changed from Closed to Open
Reopening since the assert failed again on CI:
http://ci.rvm.jp/logfiles/brlog.trunk-repeat20-asserts.20241029-211036#L2453
Updated by mame (Yusuke Endoh) 16 days ago
- Status changed from Open to Closed
Maybe fixed by 783dde2159a3689ad2d3ef6b7d0005a7cf80adba