rubycas / rubycas-client

Ruby client for Yale's Central Authentication Service protocol -- an open source enterprise single sign on system for web applications.
http://code.google.com/p/rubycas-client/
Other
332 stars 217 forks source link

segfault #16

Closed jurisgalang closed 13 years ago

jurisgalang commented 13 years ago

I'm seeing a segfault, and I've traced it down to the following method CASClient::Client#request_cas_response(uri, type) The segfault happens at this point in the method:

raw_res = https.start do |conn|
  conn.get("#{uri.path}?#{uri.query}")
end

This is on OS X, running ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-darwin10.7.0] Using rubycas-client (2.2.1) in a Rails app (version 3.0.6)

I'm wondering if anyone else is experiencing this. Or if there are certain gem or gem version combo that we could/should avoid when using rubycas-client.

Here's the Gemfile for our app:

source 'http://rubygems.org'

gem 'bundler'
gem 'rails', '3.0.6'

gem 'patron'
gem 'ruote', '2.1.11'
gem 'ruote-couch', '2.1.11'
gem 'ruote-redis', '2.1.11'
gem 'yajl-ruby'
gem 'couchrest', '1.0.1'
gem 'couchrest_model', '1.0.0'
gem 'haml'
gem 'sass'
gem 'compass'
gem 'compass-960-plugin'
gem 'lemonade'
gem 'rubycas-client'
gem 'bluecloth'
gem 'cancan', '= 1.3.4'
gem 'fastercsv'
gem 'memcache-client'
gem 'linguistics'
gem 'rubyzip', 
  :require => 'zip/zip'
gem 'rest-client'
gem 'unicorn'
gem 'paypal_adaptive'
gem 'exception_notification', 
  :require => 'exception_notifier'

group :daemon do
  gem 'daemons-mikehale', 
    :require => 'daemons'
end

group :development do
  gem 'ruby-debug'
  gem 'ruby-prof'
  gem 'rspec-rails'
end

group :test do
  gem 'fakeweb'
  gem 'ruby-debug'
  gem 'rspec'
  gem 'rspec-rails'

  gem 'cucumber', '0.9.2'
  gem 'cucumber-rails', '0.3.2'

  gem 'database_cleaner'

  gem 'capybara', '0.3.9'

  gem 'webrat' 
  gem 'launchy'
end

Thanks.

jurisgalang commented 13 years ago

I tracked this down further into an issue with the MacPorts version of openssl; @1.0.0d; I was using rvm + ruby 1.8.7p174 compiled with the openssl

It turns out there were two versions/flavors installed - the stock openssl for OS X, and the one that got installed by MacPorts as a dependency from another MacPorts package (eg: curl)

From what I could tell, even though I've compiled ruby to be configured with a specific openssl package (eg: MacPorts or the one that's provided as a package via rvm, see: http://beginrescueend.com/packages/openssl/), when the code in rubycas-client executes, it ends up using another (possibly incompatible version that was installed on the system) - this is probably true for any gem that requires openssl running within Rails.

Uninstalling MacPorts completely and re-installing ruby fixed the issue. This time around ruby was compiled using the openssl package from rvm:

rvm package install openssl
rvm install 1.8.7-p174 --with-openssl-dir=$HOME/.rvm/usr 

The package that comes from rvm has a newer version (0.9.8n) of the library than the one that comes with OS X ( vs 0.9.8l) - these two appear to be compatible with each other.

Reinstalling ruby configured with openssl the comes with OS X alone also works.

Aeon commented 12 years ago

Thank you for documenting your solution, this just saved me a huge headache!