简体   繁体   中英

segmentation fault when trying to start rails

I was running "rails server" on the console when my internet connection was interrupted.

When I tried to run rails, I got a segmentation fault.

When I executed

rails server

or

rails dbconsole

I got /usr/local/rvm/gems/ruby-2.0.0-p247/gems/sqlite3-1.3.3/lib/sqlite3/sqlite3_native.so: [BUG] Segmentation fault

I commented out sqlite from my Gemfile, then started up rails server successfully and then stopped it. I then uncommented sqlite and started rails server. Everything seems to be OK now.

Can anyone explain what happened? Should I be concerned about this. What should I do if this happens again?

I'm running ruby 1.8.7 and rails 3.0.5

The problem seems to happen because your environment is not configured properly, you write that you use ruby 1.8.7 but he error comes from ruby-2.0.0-p247 , such things happen when your shell initialization files reset/reconfigure PATH after RVM was loaded. To fix it one time run:

rvm use 1.8.7 --install

To fix it long term run:

rvm get stable --auto-dotfiles

and make sure to read all the outputs, RVM will give you warnings if things can be fixed automatically.

After the problem is fixed install gems for application:

bundle install

and try running application again:

rails s

Additionally to the misconfiguration I would advice you update your ruby because it is very old ruby that is no more supported and will not get security updates, so instead of the first command use:

rvm get stable
rvm use ruby --install --default --ruby-version

RVM resolves the name ruby to latest known version of ruby, --install will tell it to install the ruby if missing, --default will set this ruby as default and --ruby-version will generate .ruby-version file which loads the selected ruby when changing directories to the application folder (with cd ).

Ruby 1.8.7 is no more supported and will not get any security updates, you should update ASAP:

rvm use --install 2.0.0

Install application gems:

bundle install

And start rails again:

rails s

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM