Project

General

Profile

Actions

Bug #19381

closed

SEGV - ivars, both Ubuntu & Windows

Added by MSP-Greg (Greg L) over 1 year ago. Updated over 1 year ago.

Status:
Closed
Assignee:
-
Target version:
-
ruby -v:
ruby 3.3.0dev (2023-01-26T07:31:08Z master 6422fef90c) [x86_64-linux]
[ruby-core:112052]

Description

I've used code similar to the below for a long time. When max is set to 50, it runs. When max is set to 51, it SEGV faults.

Rubies tested:
ruby 3.3.0dev (2023-01-26T07:31:08Z master 6422fef90c) [x86_64-linux]
ruby 3.3.0dev (2023-01-26T07:31:08Z master 6422fef90c) [x64-mingw-ucrt]
ruby 3.3.0dev (2023-01-26T07:31:08Z master 6422fef90c) [x64-mswin64_140]

I suspect it involves the changes in https://github.com/ruby/ruby/pull/7183 'Limit maximum number of IVs on a shape'

module Test
  class << self
    def run
      max = 51
      (1..max).each do |v|
        instance_variable_set("@iv#{v}".to_sym, nil)
      end
    end
  end
end
Test.run
puts Test.instance_variables

Related issues 1 (0 open1 closed)

Related to Ruby master - Bug #19334: Defining many instance variables and accessing them is slow in Ruby 3.2.0Closedtenderlovemaking (Aaron Patterson)Actions

Updated by luke-gru (Luke Gruber) over 1 year ago

Recently there was a change to object shapes, and there were no tests made for that commit. I think they'll add some now :)
The change is here, made on Jan. 25: https://github.com/ruby/ruby/commit/78fcc9847a9db6d42c8c263154ec05903a370b6b

It looks like objects other than T_OBJECTs are being set to TOO_COMPLEX shape.

EDIT: oh sorry I didn't see you added the PR in your ticket MSP-Greg.

Updated by MSP-Greg (Greg L) over 1 year ago

Thanks. That's the commit for the PR I listed (#7183). I should have listed it...

Updated by tenderlovemaking (Aaron Patterson) over 1 year ago

Thanks. I'm going to revert the commit for now. 🙇🏻‍♀️

Actions #4

Updated by Eregon (Benoit Daloze) over 1 year ago

  • Related to Bug #19334: Defining many instance variables and accessing them is slow in Ruby 3.2.0 added

Updated by jeremyevans0 (Jeremy Evans) over 1 year ago

  • Status changed from Open to Closed
Actions

Also available in: Atom PDF

Like0
Like0Like0Like0Like0Like0