I just activated Devise’ :confirmable option in my User model. As
Devise
tries to send out the confirmation-link email I get a segmentation-fault
error in Ruby’s SMTP library:
… lib/ruby/1.9.1/net/smtp.rb:583: [BUG] Segmentation fault
My config/environments/development.rb file has the following:
config.action_mailer.delivery_method = :smtp
config.action_mailer.raise_delivery_errors = true
config.action_mailer.default_url_options = { :host => ‘localhost:3000’
}
My /config/initializers/setup_mail.rb file:
ActionMailer::Base.smtp_settings = {
:address => “smtp.gmail.com”,
:port => 587,
:domain => “mydomain.com”,
:user_name => “[redacted]”,
:password => “[redacted]”,
:authentication => “plain”,
:enable_starttls_auto => true
}
ActionMailer::Base.default_url_options[:host] = “localhost:3000”
The relevant code in smtp.rb are these two methods:
def ssl_socket(socket, context)
OpenSSL::SSL::SSLSocket.new socket, context
end
def tlsconnect(s)
verified = false
s = ssl_socket(s, @ssl_context)
logging “TLS connection started”
s.sync_close = true
s.connect # THIS IS LINE 583
if @ssl_context.verify_mode != OpenSSL::SSL::VERIFY_NONE
s.post_connection_check(@address)
end
verified = true
s
ensure
s.close unless verified
end
I’ve tried setting :enable_starttls_auto to false. I don’t get a
segmentation fault, but no mail goes out either. I can get a session
going with the gmail smtp host via the command line. I’m running on the
latest version of Mac OS.
Never had to debug a segmentation fault before. Pretty intimidating.
Any thoughts, ideas, approaches?