Segmentation fault on dev environment setup

(Silver Quettier) #1

Planning to dive in Discourse and start developping plugins, I set up the Vagrant Discourse dev VM following the instructions in the Dev install guide and, being on a Windows dev machine (yeah, I know…), Sam’s related blog post.

After SSH’ing in the VM, I installed the gems, which went fine if you except a warning about Bundler not being the latest version.
However, the DB setup phase failed with a segfault:

$ bundle exec rake db:migrate --trace

** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
/usr/local/rvm/gems/ruby-2.0.0-p0-turbo/gems/redis-3.0.7/lib/redis/connection/hiredis.rb:16: [BUG] Segmentation fault
ruby 2.0.0p0 (2013-02-24 revision 39474) [i686-linux]

Having a look under the hood, I can see the line it chokes on is:

connection.connect(config[:host], config[:port], Integer(config[:timeout] * 1_000_000))

(connection is a ::Hiredis::Connection)
I couldn’t go much further as I’m not familiar with Ruby, and I don’t know how to trace the contents of config.

Is this a common issue? I did not find anything.
I’m using Vagrant 1.6.3 with VirtualBox 4.3.12 on a Windows 7 64 machine, the only change I made to the Vagrantfile is to add config.proxy parameters.

(Sam Saffron) #2

Ruby 2.0 p0 is trouble, that image needs to be updated to latest Ruby 2.0

(Silver Quettier) #3

Thanks for the quick reply @sam ! (Do you have a brain-to-ethernet attachment?)

In fact, judging from the Vagrantfile, it seems it runs on ruby1.9.3. But the image’s .ruby-version.sample suggests ruby-2.0.0-p195 and ruby -v gives me, as you said, 2.0.0p0. Wierd. (The latest 2.0-branch version being 2.0.0-p481 as I’m writing this.)


So if I understand well, the apt-get call from the Vagrantfile which installs ruby 1.9.3 is a prerequisite to Chef, and Chef is later tasked with updating ruby to 2.0.0-p195. I’ll try to fix the image and post a workaround here until you make an offiial update to the vagrantfile/cookbooks. :slight_smile:

(Silver Quettier) #4

So if someone faces the same problem, this amounts to the following:

On a non-borked VM (I did a vagrant destroy then vagrant up), run the following commands:

  • $ rvmsudo rvm get stable
  • $ rvm install 2.0.0-p481
  • $ rvm alias create default ruby-2.0.0-p481

You can then proceed with $ bundle install and so on.
I was thinking about submitting a pull request with a Vagrantfile / Chef cookbooks update, but I’m not familiar enough with these tools and would probably end up doing a sloppy job.