Segmentation fault using ActionMailer with Ruby 1.9.3-p125 - ruby-on-rails

I was happily sending email from my web app using ActionMailer, using ruby 1.9.2-p180. Then I upgraded to ruby 1.9.3-p125, using RVM.
Now I am getting a segmentation fault every time I try to send and email.
/Users/disaacs/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/net/smtp.rb:583: [BUG] Segmentation fault
ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin10.8.0]
-- Control frame information -----------------------------------------------
c:0092 p:---- s:0499 b:0499 l:000498 d:000498 CFUNC :connect
c:0091 p:0059 s:0496 b:0496 l:000495 d:000495 METHOD /Users/disaacs/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/net/smtp.rb:583
c:0090 p:0255 s:0491 b:0490 l:001180 d:001180 METHOD /Users/disaacs/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/net/smtp.rb:560
c:0089 p:0047 s:0482 b:0482 l:000481 d:000481 METHOD /Users/disaacs/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/net/smtp.rb:519
c:0088 p:0496 s:0475 b:0475 l:000474 d:000474 METHOD /Users/disaacs/.rvm/gems/ruby-1.9.3-p125/gems/mail-2.3.0/lib/mail/network/delivery_methods/smtp.rb:128
c:0087 p:0031 s:0464 b:0464 l:000463 d:000463 METHOD /Users/disaacs/.rvm/gems/ruby-1.9.3-p125/gems/mail-2.3.0/lib/mail/message.rb:1989
c:0086 p:0009 s:0460 b:0460 l:000436 d:000459 BLOCK /Users/disaacs/.rvm/gems/ruby-1.9.3-p125/gems/mail-2.3.0/lib/mail/message.rb:230
c:0085 p:0021 s:0458 b:0458 l:000440 d:000457 BLOCK /Users/disaacs/.rvm/gems/ruby-1.9.3-p125/gems/actionmailer-3.1.1/lib/action_mailer/base.rb:432
I've seen some similar questions, but nothing with definitive answers. Is this a well know issue with no answer?
I am running Rails 3.1.1 on OSX 10.6.8.

I ran into a similar issue with Paperclip that was related to how openssl was compiled when installing ruby 1.9.3. Not 100% sure this is the same issue your having, but I'd bet it is.
To solve this issue I reinstalled ruby and fresh gemset after installing the rvm openssl pkg:
$ rvm pkg install openssl
$ rvm remove 1.9.3-p125
$ rvm install 1.9.3-p125 --with-openssl-dir=$rvm_path/usr

Related

How do I change the default Rails version that gets used?

ANSWERED (other noobs should read what I did):
Thanks to those who answered, but I think I know why it had still been defaulting to the system ruby earlier. I started a shell session and installed rbenv, then install ruby-build for rbenv, then install ruby 2.1.2 and ran rbenv global 2.1.2 Then I installed the new version of rails and tried to create a new rails project.
I think the mistake was just that I hadn't started a new shell session and so it defaulted to the rails location it had when the session started, which was with the system ruby. Stupid mistake. Blah.
ORIGINAL POST:
These are my rbenv versions
system
* 2.1.2 (set by /home/ab/.rbenv/version)
and this is what I get when I run
gem list -d rails
rails (4.2.0.beta1, 4.1.1)
Author: David Heinemeier Hansson
Homepage: http://www.rubyonrails.org
License: MIT
Installed at (4.2.0.beta1): /home/ab/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0
(4.1.1): /home/ab/.rbenv/versions/2.1.2/lib/ruby/gems/2.1.0
The Hartl tutorial online uses 4.2.0beta1, so I want to use that, but when I try to make a new rails project, it defaults to 4.1.1.
Somebody from this suggested a way to change a default rails version, but the command looks in the wrong location. See here
ab#abpc:~/Code/RailsTutorial$ rails _4.2.0beta1_ -v
/usr/lib/ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find railties (= 4.2.0beta1) amongst [actionmailer-4.1.1, actionpack-4.1.1, actionview-4.1.1, activemodel-4.1.1, activerecord-4.1.1, activesupport-4.1.1, arel-5.0.1.20140414130214, builder-3.2.2, bundler-1.3.5, coffee-rails-4.0.1, coffee-script-2.2.0, coffee-script-source-1.7.0, diff-lcs-1.2.5, erubis-2.7.0, execjs-2.1.0, hike-1.2.3, i18n-0.6.9, jbuilder-2.0.7, jquery-rails-3.1.0, json-1.8.1, libv8-3.16.14.3-x86_64-linux, mail-2.5.4, mime-types-1.25.1, mini_portile-0.6.0, minitest-5.3.4, multi_json-1.10.1, net-http-persistent-2.9, nokogiri-1.6.2.1, polyglot-0.3.5, rack-1.5.2, rack-protection-1.5.3, rack-test-0.6.2, rails-4.1.1, railties-4.1.1, rake-10.3.2, rdoc-4.1.1, rdoc-3.9.4, ref-1.0.5, rspec-2.14.1, rspec-core-2.14.8, rspec-expectations-2.14.5, rspec-mocks-2.14.6, rspec-rails-2.14.2, sass-3.2.19, sass-rails-4.0.3, sdoc-0.4.0, sinatra-1.4.5, spring-1.1.3, sprockets-2.11.0, sprockets-rails-2.1.3, sqlite3-1.3.9, therubyracer-0.12.1, thor-0.19.1, thor-0.18.1.20140116, thread_safe-0.3.4, tilt-1.4.1, treetop-1.4.15, turbolinks-2.2.2, tzinfo-1.2.0, uglifier-2.5.0, webrat-0.7.3] (Gem::LoadError)
from /usr/lib/ruby/1.9.1/rubygems/dependency.rb:256:in `to_spec'
from /usr/lib/ruby/1.9.1/rubygems.rb:1231:in `gem'
from /usr/local/bin/rails:22:in `<main>'
I'm still far from as knowledgeable as I'd like to be, but I can see that "rails" is defaulting to usr/lib/bin/rails and I need to reroute it to ~/.rbenv/versions/2.1.2/lib/ or somewhere around there... not entirely sure where, and I don't know how to get it to do that. Help?
It looks like you are using your system ruby v1.9.1 which is not compatible with rails 4 at all (Rails 4 requires 1.9.3 or higher).
So first you need to set your ruby version using rbenv global 2.1.2 to set it system-wide or rbenv local 2.1.2 if you just want it for this project. I'm not sure if your system will then default to rails-4.1.1 or the newer beta but you can try rails -v to find out. If not, rails _4.2.0.beta1_ new myapp should work.
The Hartl tutorial online uses 4.2.0beta1
Here is what I am seeing:
Install Rails
Once you’ve installed RubyGems, installing Rails should be easy. This
tutorial standardizes on Rails 4.0, which we can install as follows:
$ gem install rails --version 4.0.8
...
but when I try to make a new rails project, it defaults to 4.1.1.
Gemfile:
source 'https://rubygems.org'
ruby '2.0.0'
#ruby-gemset=sample_app2_gems
gem 'rails', '4.0.8'
...
Set the version of rails you want to use in your Gemfile.

Rails 3.1 and Ruby 1.9.3p125: ruby-debug19 still crashes with "Symbol not found: _ruby_threadptr_data_type" [duplicate]

This question already has answers here:
Closed 10 years ago.
Possible Duplicate:
ruby-debug with Ruby 1.9.3?
I had heard rumors that ruby 1.9.3p125 has a solution for the ruby-debug19 problem, so per instructions on the RVM site, I reinstalled 1.9.3:
$ rvm reinstall 1.9.3 --patch debug --force-autoconf
$ ruby -v
ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-darwin11.2.0]
Then:
gem install ruby-debug19
Added this entry to my Gemfile:
gem 'ruby-debug19'
Then:
$ rails server -u
=> Booting WEBrick
=> Rails 3.1.3 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
You need to install ruby-debug to run the server in debugging mode. With gems, use 'gem install ruby-debug'
Exiting
To get past this error I changed my Gemfile entry to:
gem 'ruby-debug19', :require => 'ruby-debug'
Now a new error from the server:
/Users/don/.rvm/gems/ruby-1.9.3-p125/gems/activesupport-3.1.3/lib/active_support/dependencies.rb:240:in `require': dlopen(/Users/don/.rvm/gems/ruby-1.9.3-p125/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.bundle, 9): Symbol not found: _ruby_threadptr_data_type (LoadError)
Referenced from: /Users/don/.rvm/gems/ruby-1.9.3-p125/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.bundle
Expected in: flat namespace
in /Users/don/.rvm/gems/ruby-1.9.3-p125/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.bundle - /Users/don/.rvm/gems/ruby-1.9.3-p125/gems/ruby-debug-base19-0.11.25/lib/ruby_debug.bundle
I'm very confused by the hundreds of posts out there on how to handle this ruby-debug19 issue. I was hoping it had been solved. Apparently not. Any suggestions? (If anyone suggests a patch, please provide step by step instructions on how to apply it. I've struggled with patches in the past.)
A fork of ruby-debug just called 'debugger' now exists that incorporates many of the fixes people had been deploying on top of ruby-debug19, so you should be able to just change your Gemfile to
gem 'debugger'
... and off you go.
Long story short: it's not resolved, and official resolution will only come with a new version of ruby-debug19 or ruby-debug-base19. It's pretty aggravating, I know.
I've done a lot of digging on this, too, and I've kept an eye on things since 1.9.3 came out (because we'd love-love-love to use it in production). However, sadly, 1.9.3-p125 doesn't have a fix for ruby-debug. Only ruby-debug19 will have the fix for ruby-debug19, as the authors of ruby-debug19 and ruby-debug-base19 have been working on a patch and have an updated test build working on Ruby 1.9.3… but they haven't released it to the general public. ruby-debug-base19 hasn't seen a release in eons; ruby-debug19 even longer (since '09).
If you're on rvm head, you should be able to install 1.9.3-p125 with the added "falcon patch" found here (and noted about RVM here. This gist seems to have better instructions (it's a newer fork of the older one).
The best thing to do is just use pry. Its an irb-like replacement for ruby-debug and it works with all version of Ruby with no nasty patching!
https://github.com/pry/pry
You must pass the --with-ruby-include and point it at your src directory for this to work.
(most of these answers elsewhere on SO have gone stale since 1.9.3-p125.)
I've written up new instructions here for ubuntu 11.10 that work on my machine, but give them a try on darwin and see if they help?: https://gist.github.com/2218661
I've been having similar problems using Rails 3.2 with Ruby 1.9.3p0 debugging in Aptana.
For me, new ruby-debug-base193 does not compile. But what works fine is a fix that has been posted elsewhere:
Gemfile:
gem 'ruby-debug-ide19'
gem 'ruby-debug-base19'
And then providing the missing is_binary_data? method somewhere. I put it in my Rails application.rb file like so:
class String
def is_binary_data?
( self.count( "^ -~", "^\r\n" ).fdiv(self.size) > 0.3 || self.index( "\x00" ) ) unless empty?
end
end

Rails Starting Up With Wrong Version of Ruby

TLDR: How do I force a rails app to use the correct ruby interpreter?
Hello,
Something hosed parts of my Ruby 1.9.2p290 install (certain classes just went missing one day), so I removed it and attempted to reinstall the environment.
I'm running on Snow Leopard.
Ruby 1.9.2 was installed from source. (I tried to install via MacPorts and it would fail). I am not keen on RVM as I use bundler and I seem to recall some problems with how bundler and RVM interact, though from what I can tell RVM works.
After reinstalling a few gems I noticed they were being placed in a gem folder for Ruby 1.8. "This is weird," I thought.
Starting up the rails app, I notice a lot of weird exceptions being thrown regarding syntax. After printing RUBY_VERSION to stdout, I noticed that the Rails app is running 1.8.7.
which ruby shows only one ruby interpreter:
$ which ruby
/usr/bin/ruby
$ /usr/bin/ruby -v
ruby 1.9.2p290 (2011-07-09 revision 32553) [x86_64-darwin10.8.0]
If I open up Activity Monitor, the ruby process from the Rails app lives at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby, which I believe is the ruby interpreter that OSX shipped with.
I haven't found any information on completely purging Ruby from OSX. I would love to do that then simply install ruby from source.
It seems there are two problems:
Rails is running a ruby interpreter that I have no idea how it is calling, when I need it to run the 1.9.2 interpreter installed from source
gems are being installed in a 1.8 folder, I suspect because gem thinks its running under 1.8
How do I fix this?
Thank you,
Tom
I guess the best way to overcome this issue is using rvm to handle your Ruby and Rails environments through 'gemset's.
I had the same issue and I use gemsets now without a problem.
This is the article which I got things working:
http://stjhimy.com/posts/10-five-quick-steps-to-set-up-rvm-with-rails-2-and-rails3

Problem with Ruby, Rails, ZSH and RVM

When I go into my rails app folder and write:
which ruby
I get this:
/Users/gugguson/.rvm/rubies/ruby-head/bin/ruby
When I write:
ruby -v
I get this:
ruby 1.9.3dev (2010-09-25 trunk 29341) [x86_64-darwin10.4.0]
Hovever when I run my app with:
rails s
I get an error indication it is using ruby 1.8.7 my app is using:
/Users/gugguson/.rvm/gems/ruby-head/gems/sqlite3-ruby-1.3.1/lib/sqlite3/sqlite3_native.bundle: [BUG] Segmentation fault
ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
zsh: abort rails s
Do you know what can be causing this?
You might be using system installed rails script, make sure that you use rails installed inside rvm and
head $(which rails)
starts with
#!/Users/gugguson/.rvm/rubies/ruby-head/bin/ruby

Ruby on Rails undefined method `camelize' for "app":String

I just tried to play with Ruby on Rails on Snow Leopard.
I was following this tutorial:
http://developer.apple.com/tools/rubyonrails.html
Whatever I try to do with rails I end up with:
MacBook-Pro-lm:~ lukasz$ rails blog
**undefined method `camelize' for "app":String**
MacBook-Pro-lm:~ lukasz$ rails --help
**undefined method `camelize' for "app":String**
Really basic things... however - verbosing rails works:
MacBook-Pro-lm:bin lukasz$ rails -v
Rails 2.3.5
MacBook-Pro-lm:~ lukasz$ ruby -v
ruby 1.8.7 (2010-01-10 patchlevel 249) [i686-darwin10]
MacBook-Pro-lm:bin lukasz$ gem -v
1.3.7
So it seems I have installed and upgarded ruby (using macports), rubygems and rails successfully (according to terminal). There are also few other packages installed to support we development like passenger and mysql5, etc...
I can find ruby installed in the
/opt/local/bin directory. My environment PATH variable is:
PATH=/opt/local/bin:/opt/local/sbin:/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin
The is something fishy going on. It must be some stupid basic problem. Google says that there could be a problem with ruby-iconv library but I can not find/install this package using port or gem commands.
Plese help.... what am I missing here?
You might want to try to check where the gem was installed:
gem list -d rails
Compare the gem installation directory with other gems that rails needs. It seems to me that it is a ruby gems issue. Make sure all the gems was installed with macports version of rubygems. It is not possible to mix and match.
Hopefully it helps.

Resources