Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Segfault in ActiveRecord::Inheritance with Ruby 2.1.0 #14024

Closed
xtian opened this Issue Feb 12, 2014 · 6 comments

Comments

Projects
None yet
4 participants
Contributor

xtian commented Feb 12, 2014

Steps for reproduction:

$ rails new test_app -q --edge
$ cd test_app/
$ rails g model user
$ rake db:migrate
$ rails c
Loading development environment (Rails 4.1.0.beta1)
irb(main):001:0> User.new
=> #<User id: nil, created_at: nil, updated_at: nil>
irb(main):002:0> User.public_method(:new).call
/Users/xtian/.gem/ruby/2.1.0/bundler/gems/rails-f34e0c4a207d/activerecord/lib/active_record/inheritance.rb:30: [BUG] Segmentation fault at 0x00000000000018
ruby 2.1.0p0 (2013-12-25 revision 44422) [x86_64-darwin13.0]

If I try the same thing with Ruby 2.0.0, it works fine. Would this be a Ruby bug and not a Rails one?

Here's the full output from my console if that helps: https://gist.github.com/xtian/8950422

Contributor

pftg commented Feb 12, 2014

@xtian this is duplication, and was reported on rails and on ruby bug trackers, please look in the closed issues about more information.

Contributor

xtian commented Feb 12, 2014

Thanks, I didn't see it when I searched initially.

@xtian xtian closed this Feb 12, 2014

Contributor

jamo commented Feb 12, 2014

I just tried with rails/master and just installed ruby 2.1.0-dev and I couldn't reproduce this

jamo~/factory/test_app $ ruby -v
ruby 2.1.1p30 (2014-02-10 revision 44904) [x86_64-darwin13.0]
jamo~/factory/test_app $ bundle exec rails -v
Rails 4.1.0.beta1
jamo~/factory/test_app $ head Gemfile
source 'https://rubygems.org'

gem 'rails',            path: "/Users/jamo/factory/rails"

jamo~/factory/test_app $ cd  /Users/jamo/factory/rails
jamo~/factory/rails $ git log |head
commit f34e0c4a207ddb7b2f25f43f68e0efad881cfbea
Author: kayvan <kayvan.najafzadeh@gmail.com>
Date:   Sun Feb 9 11:00:45 2014 -0800

    adding missed change

commit 2862cd8e11fd76f943c224c12e90bd04c05eadd4
Author: kayvan <kayvan.najafzadeh@gmail.com>
Date:   Sun Feb 9 10:26:10 2014 -0800

jamo~/factory/rails $ cd ../test_app
jamo~/factory/test_app $ bundle exec rails c
Loading development environment (Rails 4.1.0.beta1)
irb(main):001:0> User.new
=> #<User id: nil, created_at: nil, updated_at: nil>
irb(main):002:0> User.public_method(:new)
=> #<Method: Class(ActiveRecord::Inheritance::ClassMethods)#new>
irb(main):003:0> User.public_method(:new).call
=> #<User id: nil, created_at: nil, updated_at: nil>
irb(main):004:0>

Edit: I didn't notice that you had already closed this...

Contributor

pftg commented Feb 12, 2014

#13901 just to confirm duplication

Contributor

pftg commented Feb 12, 2014

@jamox 👍

Member

zzak commented Feb 12, 2014

For what it's worth this was already fixed on trunk, if you try the following example on 2.1 you get the segfault, but not on trunk.

require 'active_record'
ActiveRecord::Base.establish_connection 'sqlite3:///:memory:'
ActiveRecord::Base.connection.create_table :users do |t|
  t.string :name
end
class User < ActiveRecord::Base; end
User.new
p User.public_method(:new).call
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment