fusion passenger issue with json gem when running on nginx - ruby

I have spent the better half of today trying to resolve an issue where fusion passenger fails to process the request due to some segment fault issue within the json gem.
There have been similar posts regarding this issue, however none of the solutions have appeared to work. I have tried to clear the gems and re bundle, e.g. gemset empty, bundle install.
The interesting this about this is running rails server is ok, and running fusion-passenger stand alone is fine too, only when running under nginx do I have this issue.
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/json-1.8.1/lib/json/common.rb:67: [BUG] Segmentation fault
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]
Web application could not be started
An error occurred while starting up the preloader. It exited before signalling successful startup back to Phusion Passenger. Please read this article for more information about this problem.
Raw process output:
/usr/local/rvm/gems/ruby-2.0.0-p481/gems/json-1.8.1/lib/json/common.rb:67: [BUG] Segmentation fault
ruby 1.9.3p484 (2013-11-22 revision 43786) [x86_64-linux]

I found the issue and resolved it. ngnix was defaulting to ruby 1.9.3, a version fusion passenger has installed. I only installed one version 2.0.0 of ruby through rvm. All i had to do was set the nginx config file to the ruby wrapper and all was good. The world is once again a happy place!
passenger_ruby /usr/local/rvm/wrappers/ruby-2.0.0-p481/ruby;

Related

How to fix "uninitialized constant Gem::GEM_PRELUDE_SUCKAGE" in RubyGems tasks

My RubyGems isn't working, throwing an error which goes as follows, triggering (nearly) on any Gem task:
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/rubygems.rb:1081:in `<top (required)>': uninitialized constant Gem::GEM_PRELUDE_SUCKAGE (NameError)
from <internal:gem_prelude>:1:in `require'
from <internal:gem_prelude>:1:in `<compiled>'
I'm new to Ruby / RubyGems / installing Ruby and all I know is that an uninitialized constant is essentially a undefined variable. It could also be possible that it's something with Ruby itself, although the ->Gem:GEM<-_PRELUDE_SUCKAGE points me to RubyGems.
In a nutshell, I installed a bunch of Ruby things (think RVM, rbenv, etc.) to develop Ruby on Rails, as I thought it would be a good way to learn Ruby.
Well, after going through a long and tedious process to upgrade Ruby to 2.6.3, then downgrade to 2.5.5 and then 2.4.0, then back up to 2.5.5 and solving downgrade issues, RubyGems throws the error. I settled on 2.5.5 because 2.6.3 caused errors and 2.4.0 was too early of a version.
It's causing all sorts of errors, like HAML not compiling and Rails not making a controller. I really don't know what's happening.
If I run gem install [gem name], it throws the error. Running rails generate controller [name] index (for those not familiar to Rails this creates, well, a controller) it throws the error. Doing anything really with the gem command causes the error, except for gem server.
If I upgrade back up to the latest Ruby version, I fear that my gem command will go all wonky again and I'll have to go through another day of troubleshooting versions. How do I fix this, or at least get rid of the message so I can create things again?
I had this happen to me just today. It seems, somehow, my ruby version had been corrupted. When I ran rvm list version 2.5.1 was listed as 'broken'. I had to uninstall 2.5.1 fully (using sudo even in my case) to get to a clean slate.
Then, when attempting to reinstall, rvm was giving me all kinds of grief after a new gpg key which I initialy couldn't get to install properly (hint).
After a clean wipe of ruby 2.5.1, updating rvm to latest version and reinstalling, I got this error: Error running 'env GEM_HOME=/ruby-2.5.1#global GEM_PATH= /Users/user/.rvm/rubies/ruby-2.5.1/bin/ruby -d /Users/user/.rvm/src/rubygems-3.0.8/setup.rb --no-document',.
It appears that an update to MacOSX deprecated a version of OpenSSL which causes some issues. I ended up following this thread and ran rvm gemset create global --default and then bundle install to get passed the Gem errors.
Honestly, rails is supposed to be easier than this. I wish docker was easier to reason about sometimes. These are the kinds of issues docker supposedly promises to fix eh?

ruby-2.0.0-p353 [BUG] Bus Error while running rspec

Whenever I run rspec, I get this long error message.
/Users/jkim/.rvm/gems/ruby-2.0.0-p353/bin/ruby_executable_hooks: [BUG] Bus Error
ruby 2.0.0p353 (2013-11-22 revision 43784) [x86_64-darwin11.4.2]
See the full error here.
http://hastebin.com/vuvucemawo.pas
Note that the rspec tests ran correctly.
What are some things I can try to fix this issue?
I meet the same issue.
Here is the full stack trace: https://gist.github.com/proxygear/8658364
I'm on a mac with ruby-2.0.0-p353 installed via rvm
I don't get any bus error except when running spec (server, console work fine).
The closest error I found on stackoverflow is BUG Bus Error ruby 1.8.7 but is connected with installing ruby more than runtime error.

Failing deploy with RVM + unicorn

I'm trying to setup a Sinatra App with unicorn.
After following this example
and adjusting it to my needs, I've gotten this error:
<my_path_name>/vendor/bundle/ruby/1.9.1/gems/kgio-2.8.0/lib/kgio.rb:21:in 'require': cannot load such file -- kgio_ext (LoadError)
I'm using rvm 1.18.5, ruby 1.9.3p374 (2013-01-15 revision 38858) [x86_64-linux] and the latest release of unicorn 4.5.0 which pulls kgio 2.8.0
The OS is Red Hat Enterprise Linux Server release 5.6.
I've also tried with ruby-1.9.3-p125.
Sounds like a similar problem here, maybe try one of those ideas.
Did the gem install go smoothly?

Rails 3 continues to use ruby 1.8.7 even though "ruby -v" states 1.9.2

I have finished developing my app and am currently deploying it. I'm getting a weird error from one of my controllers:
syntax error, unexpected ':', expecting ')'
When I run it in my dev environment it works fine. The only difference I can see between dev/prod is that dev is is using Ruby 1.9.2 and Prod is using 1.8.7. In my naivete I thought "Oh I'll just upgrade to 1.9.2" - what I fool I've been. I used RVM, changed my path, started new terminal session and now can see ruby is at 1.9.2:
ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-linux]
which ruby
/usr/local/rvm/rubies/ruby-1.9.2-p290/bin/ruby
However, when I run a "rails s" my computer continues to use 1.8.7:
[2011-10-05 05:58:40] INFO WEBrick 1.3.1
[2011-10-05 05:58:40] INFO ruby 1.8.7 (2010-08-16) [x86_64-linux]
[2011-10-05 05:58:45] INFO WEBrick::HTTPServer#start: pid=32574 port=3000
What the what!!!? I hope someone can help me. I'm about 15 minutes away from moving to the country, and become a farmer!
Thanks in advance.
if you used sudo when installed it might be the reason
sudo passenger-install-apache2-module
uses system ruby. Try
passenger-install-apache2-module
which should produce proper config files.
Have you tried rvm reload ? sometimes when I get strange errors like that reloading rvm fixes it.

Rake Command not working after upgrade rails and ruby version

I am getting an error when i am running any sort of rake command , it is showing me
rake aborted!
no such file to load -- config/environment
I am trying to upgrade the ruby version from ruby 1.8.7 to ruby 1.9.2 and rails 2.3.11 to rails 3.0.9 and when i am trying to start the server it is showing me
Value assigned to config.time_zone not recognized.Run "rake -D time" for a list of tasks for finding appropriate time zone names. (RuntimeError)
I am using RVM for this upgrade
ruby -v
ruby 1.9.2p180 (2011-02-18 revision 30909) [i686-linux]
rails -v
Rails 3.0.9
You can't just upgrade from Rails 2 to 3 without some rather extensive preparation. All hell will break loose. Check out these Railscasts for starters:
http://railscasts.com/episodes/225-upgrading-to-rails-3-part-1
http://railscasts.com/episodes/226-upgrading-to-rails-3-part-2
http://railscasts.com/episodes/227-upgrading-to-rails-3-part-3
There might be newer resources out there. I'd also suggest to upgrade first ruby and then Rails, or vice versa, not both at the same time. Divide and conquer.
Peepcode Rails 3 Upgrade Handbook PDF
Rails Core suggestions: Plugin to run checks on your Rails 2.x/3.x to check for obvious upgrade points on the path to 3.0.

Resources