Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Segfault in ActiveRecord::Inheritance with Ruby 2.1.0 #14024

Closed
xtian opened this Issue · 6 comments

4 participants

@xtian

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

@pftg

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

@xtian

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

@xtian xtian closed this
@jamox

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...

@pftg

#13901 just to confirm duplication

@zzak
Collaborator

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
Something went wrong with that request. Please try again.