Skip to content

Conversation

@dalehamel
Copy link
Contributor

@dalehamel dalehamel commented Aug 21, 2025

Adds a ruby 3.3.0 coredump that is a version of the infinite sleep program, but with the functions inside of some nested classes.

I was ran it with this test program:

if ARGV.length == 1
    $sleep_time = ARGV[0].to_i
else
    $sleep_time = 0.5
end

class A
  def aaa()
      sleep($sleep_time)
  end
end

class B
  class Ab
    def bbb()
        A::new.aaa()
    end
  end
end

class C
  class Cb
    def ccc()
        B::Ab.new.bbb()
    end
  end
end

def looper
  loop do
      C::Cb.new.ccc()
  end
end

looper

For which I expect something like:

<main> - /Users/dalehamel/src/github.com/rbspy/rbspy/ci/ruby-programs/infinite_on_cpu_with_classes.rb:35
Object#looper - /Users/dalehamel/src/github.com/rbspy/rbspy/ci/ruby-programs/infinite_on_cpu_with_classes.rb:33
loop - unknown:173
block in looper - /Users/dalehamel/src/github.com/rbspy/rbspy/ci/ruby-programs/infinite_on_cpu_with_classes.rb:32
C::Cb#ccc - /Users/dalehamel/src/github.com/rbspy/rbspy/ci/ruby-programs/infinite_on_cpu_with_classes.rb:25
B::Ab#bbb - /Users/dalehamel/src/github.com/rbspy/rbspy/ci/ruby-programs/infinite_on_cpu_with_classes.rb:17
A#aaa - /Users/dalehamel/src/github.com/rbspy/rbspy/ci/ruby-programs/infinite_on_cpu_with_classes.rb:10
sleep [c function] - (unknown)

When i try running the tests pointing at my local crate though, it shits the bed trying to allocate and absurd amount of memory...

ok
memory allocation of 140720308515840 bytes failed
error: test failed, to rerun pass `--lib`

@dalehamel
Copy link
Contributor Author

Ok i found the source of the memory allocation error - ruby was legitimately reporting the size of the string to be that large when reading the absolute path 😅

I created a workaround in my PR to allow a maximum size to read, and set this to the maximum path size of 4096.

@dalehamel dalehamel marked this pull request as ready for review August 25, 2025 17:14
@acj acj merged commit e64ac75 into rbspy:main Aug 31, 2025
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants