ruby-prof / ruby-prof

A ruby profiler. See https://ruby-prof.github.io for more information.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Segfault with Ruby 3.3.0

cfis opened this issue · comments

I'm also experiencing this issue on macOS 14.2.1 (23C71) on Ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [x86_64-darwin23]

Also tested against ruby 3.4.0dev (2023-12-25T09:36:28Z master a164a34110) [arm64-darwin23] compiled with --with-openssl-dir=/opt/homebrew/opt/openssl@3

It does not happen on 3.2.2 (which was compiled on a different version of macOS)

I have a reduced test case:

#!/usr/bin/env ruby -s
# frozen_string_literal: true

require 'bundler/inline'

gemfile do
  source 'https://rubygems.org'

  gem 'ruby-prof'
end

RubyProf::Profile.profile do
  Array.new # `Object.new` works, for example
end

Ruby has been compiled with options

rvm install 3.3.0 --with-openssl-dir=/usr/local/opt/openssl@1.1 --with-libyaml
Log
$ bundle exec ./test/profile.rb 
./test/profile.rb:13: [BUG] Segmentation fault at 0x0000000000000004
ruby 3.3.0 (2023-12-25 revision 5124f9ac75) [x86_64-darwin23]

-- Crash Report log information --------------------------------------------
   See Crash Report log file in one of the following locations:             
     * ~/Library/Logs/DiagnosticReports                                     
     * /Library/Logs/DiagnosticReports                                      
   for more details.                                                        
Don't forget to include the above Crash Report log file in bug reports.     

-- Control frame information -----------------------------------------------
c:0004 p:0004 s:0014 e:000012 BLOCK  ./test/profile.rb:13 [FINISH]
c:0003 p:---- s:0010 e:000009 CFUNC  :profile
c:0002 p:0016 s:0006 e:000005 EVAL   ./test/profile.rb:12 [FINISH]
c:0001 p:0000 s:0003 E:000ea0 DUMMY  [FINISH]

-- Ruby level backtrace information ----------------------------------------
./test/profile.rb:12:in `<main>'
./test/profile.rb:12:in `profile'
./test/profile.rb:13:in `block in <main>'

-- Threading information ---------------------------------------------------
Total ractor count: 1
Ruby thread count for this ractor: 1

-- Machine register context ------------------------------------------------
 rax: 0x0000000000000004 rbx: 0x000000010ad23218 rcx: 0x3d81101bcbfe00e7
 rdx: 0x0000000000000001 rdi: 0x00000003090dd330 rsi: 0x000000005f5f6465
 rbp: 0x00000003090dd3d0 rsp: 0x00000003090dd3b0  r8: 0xbfe7490106e76130
  r9: 0x000000000000056d r10: 0x00007fe748268000 r11: 0x000000000000017f
 r12: 0x000000000011e10c r13: 0x000000010ad23218 r14: 0x00006000006fc5d0
 r15: 0x00006000006fc5b0 rip: 0x000000010b6e6e07 rfl: 0x0000000000000206

-- C level backtrace information -------------------------------------------
~/.rvm/rubies/ruby-3.3.0/lib/libruby.3.3.dylib(rb_vm_bugreport+0x999) [0x10baff339]
~/.rvm/rubies/ruby-3.3.0/lib/libruby.3.3.dylib(rb_bug_for_fatal_signal+0x148) [0x10b925728]
~/.rvm/rubies/ruby-3.3.0/lib/libruby.3.3.dylib(sigsegv+0x5b) [0x10ba5b9bb]
/usr/lib/system/libsystem_platform.dylib(_sigtramp+0x1d) [0x7ff81472537d]
~/.rvm/gems/ruby-3.3.0/gems/ruby-prof-1.6.3/lib/ruby_prof.bundle(resolve_klass+0x77) [0x10b6e6e07]
~/.rvm/gems/ruby-3.3.0/gems/ruby-prof-1.6.3/lib/ruby_prof.bundle(prof_method_create) [0x10b6e6fa1]
~/.rvm/gems/ruby-3.3.0/gems/ruby-prof-1.6.3/lib/ruby_prof.bundle(check_method) [0x10b6e827b]
~/.rvm/gems/ruby-3.3.0/gems/ruby-prof-1.6.3/lib/ruby_prof.bundle(prof_get_profile) [0x10b6e8671]
~/.rvm/rubies/ruby-3.3.0/lib/libruby.3.3.dylib(exec_hooks_protected+0xc5) [0x10bb007d5]
~/.rvm/rubies/ruby-3.3.0/lib/libruby.3.3.dylib(rb_exec_event_hooks+0x5d) [0x10bb0057d]
~/.rvm/rubies/ruby-3.3.0/lib/libruby.3.3.dylib(vm_call_cfunc_with_frame_+0x2c5) [0x10baf18b5]
~/.rvm/rubies/ruby-3.3.0/lib/libruby.3.3.dylib(vm_exec_core+0x2a91) [0x10bad55a1]
~/.rvm/rubies/ruby-3.3.0/lib/libruby.3.3.dylib(rb_vm_exec+0x1ae) [0x10bad19ee]
~/.rvm/rubies/ruby-3.3.0/lib/libruby.3.3.dylib(invoke_block_from_c_bh+0x457) [0x10baf9757]
~/.rvm/rubies/ruby-3.3.0/lib/libruby.3.3.dylib(rb_yield+0xa7) [0x10bae1167]
~/.rvm/rubies/ruby-3.3.0/lib/libruby.3.3.dylib(rb_protect+0xcd) [0x10b93220d]
~/.rvm/gems/ruby-3.3.0/gems/ruby-prof-1.6.3/lib/ruby_prof.bundle(rp_init_profile) [0x10b6e9192]
~/.rvm/rubies/ruby-3.3.0/lib/libruby.3.3.dylib(vm_call_cfunc_with_frame_+0x134) [0x10baf1724]
~/.rvm/rubies/ruby-3.3.0/lib/libruby.3.3.dylib(vm_exec_core+0x27ca) [0x10bad52da]
~/.rvm/rubies/ruby-3.3.0/lib/libruby.3.3.dylib(rb_vm_exec+0x38d) [0x10bad1bcd]
~/.rvm/rubies/ruby-3.3.0/lib/libruby.3.3.dylib(rb_ec_exec_node+0x9e) [0x10b93152e]
~/.rvm/rubies/ruby-3.3.0/lib/libruby.3.3.dylib(ruby_run_node+0x5e) [0x10b93142e]
~/.rvm/rubies/ruby-3.3.0/bin/ruby(main+0x65) [0x10279df55]

Originally posted by @tagliala in #326 (comment)_