Rails [3.1.0.rc1] webrick freeze on http 500 error - ruby-on-rails

since I installed rails 3.1.0, when some bugs occur, Webrick freezes for a couple of minutes when some bugs occur (not all bugs, apparently the 500 ones).
My gemfile looks like this:
source 'http://rubygems.org'
gem "rails", "3.1.0.rc1"
#Asset template engines
gem 'sass'
gem 'coffee-script'
gem 'uglifier'
gem 'jquery-rails'
gem "simple-navigation"
gem 'ranked-model' #, :git => 'git#github.com:harvesthq/ranked-model.git'
gem 'formtastic'
gem 'validation_reflection'
gem "paperclip", "~> 2.3"
gem 'devise'
gem 'heroku'
gem "aws-s3"
gem "scoped_search"
gem "meta_search", :git => 'git://github.com/ernie/meta_search.git'
gem "kaminari"
group :production do
gem "pg", "~> 0.11.0"
gem 'therubyracer-heroku', '0.8.1.pre3'
gem 'exception_notification', :require => 'exception_notifier'
end
group :development, :test do
gem 'mysql2'
end
require 'csv'
I'm on Mac OS X 10.6.7.
Can anyone help me on this? Thanks,
Nicolas

Try using mongrel, or another dev server such as unicorn.
Just add it to your gemfile
gem 'mongrel'

Related

Rails Memory Bloat or Leak?

This is my current memory consumption on Heroku. I only have one endpoint that I see on scout being called repeatedly. It seems as if there is a lot of bloat during the startup and then it seems to plateau off later in the day. Is something like this indicative of a memory leak?
I've gone through and updated most of the gems I use to try and resolve this error. However, it's still very high and a bit concerning to me.
Here is my gem file.
source "https://rubygems.org"
ruby "2.3.1"
gem "rails", "5.0.1"
gem "aasm"
gem "active_model_serializers", "0.9.3"
gem "activeadmin-poro-decorator"
gem "activejob"
gem "api-auth"
gem "autoprefixer-rails"
gem "aws-sdk", "~> 2"
gem "axlsx", "2.1.0.pre"
gem "bcrypt"
gem "blanket_wrapper", require: "blanket"
gem "bootsnap"
gem "chroma"
gem "devise"
gem "dotenv-rails"
gem "dwolla_v2", "~> 1.1.2"
gem "foreman"
gem "geoip"
gem "httparty"
gem "jira-ruby", require: "jira-ruby"
gem "jquery-rails"
gem "kaminari"
gem "lightspeed_ruby", require: "lightspeed"
gem "mandrill-api", require: "mandrill"
gem "money-rails"
gem "omniauth"
gem "omniauth-lightspeed-pos"
gem "paid", git: "https://github.com/zamith/paid-ruby.git", branch: "zamith/support-pagination"
gem "paper_trail"
gem "paperclip"
gem "pg"
gem "phony_rails"
gem "puma"
gem "pundit"
gem "rack-attack"
gem "rack-cors", require: "rack/cors"
gem "roadie-rails", "~> 1.0"
gem "sidekiq"
gem "sidekiq-cron"
gem "simple_token_authentication", "~> 1.0"
gem "slack-notifier"
gem "slim-rails"
gem "stripe"
gem "textris"
gem "thor", "0.19.1"
gem "twilio-ruby"
gem "typhoeus"
gem "tzinfo-data"
gem "uglifier", ">= 1.3.0"
gem "validates_zipcode"
gem "webpacker", "~> 2.0"
gem "webpacker-react", "~> 0.3.1"
gem "wicked_pdf"
gem "wkhtmltopdf-binary"
gem "zepto-for-rails"
gem 'zip-codes'
gem "activeadmin", git: "https://github.com/activeadmin/activeadmin.git", ref: "01db1a"
gem "inherited_resources", git: "https://github.com/activeadmin/inherited_resources"
group :development do
gem "letter_opener"
gem "letter_opener_web"
gem "parity"
gem "rails-erd"
gem "subcontractor"
gem "web-console", "~> 2.0"
end
group :test do
gem "capybara"
gem "capybara-selenium"
gem "capybara_discoball"
gem "climate_control"
gem "codeclimate-test-reporter", "~> 1.0.0"
gem "database_cleaner"
gem "fake_stripe"
gem "fakeredis", require: "fakeredis/rspec"
gem "pdf-reader"
gem "rspec"
gem "rspec-retry"
gem "selenium-webdriver"
gem "simplecov"
gem "sinatra", "2.0.0.rc2"
gem "sinatra-contrib", "2.0.0.rc2", require: false
gem "sinatra-cross_origin"
gem "stackprof"
gem "timecop"
gem "vcr"
gem "webmock"
end
group :development, :test do
gem "factory_girl_rails"
gem "faker"
gem "headless"
gem "pry-rails"
gem "pry-remote"
gem "rspec-rails", "~> 3.4"
gem "rubocop"
gem "spring"
gem "spring-commands-rspec"
end
group :production, :staging do
gem "oj"
gem "rails_12factor"
gem "rollbar"
gem "scout_apm"
end
I'm having trouble interpreting whether this is a memory leak or memory bloat from boot.
This seems to be an ongoing issue with this gem, 2 years after this post.
I myself am experiencing memory issues with this gem.
Derailed Benchmarks
twilio-ruby: 19.0 MiB
You can track the progress here as this issues is being addressed.
https://github.com/twilio/twilio-ruby/issues/396
Try the 'Derailed Benchmarks' gem. I noticed while running mine that the twilio-ruby gem was one of the biggest memory hogs # 21MB.
https://github.com/schneems/derailed_benchmarks

Stack level too deep upgrading to Rails 3

I'm upgrading an app to Rails 3 and have been going through it bit by bit, for example replacing all the old plugins with the relevant gems in the gemfile.
I seem to have got stuck however because now whenever I try to run the server I get this:
=> Booting WEBrick
=> Rails 3.0.0 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
Exiting
/Users/camillavk/.rvm/gems/ruby-1.9.3-p551#rails3/gems/rack-1.2.8/lib/rack/builder.rb:35: stack level too deep (SystemStackError)
I've been googling it for ages and have come to the conclusion that it is still because of one of the plugins, I just can't figure out which one. I have removed each one individually but none of them makes a difference.
I found these three similar questions but they don't really help me....
Stack level too deep error after running bundle update
SystemStackError at the rack level in Ruby 1.9.2, not 1.8.7
Stack level too deep trying to update from 3.0 to 3.1
My gemfile looks like this at the moment:
source 'https://rubygems.org'
gem "rails", "3.0.0"
#need to replace old acts_as_commentable vendor plugin
gem 'acts_as_commentable', '3.0.1'
gem "airbrake"
#need to add authlogic gem
gem 'authlogic', '~> 2.1.6'
gem "aws-s3"
gem "bj"
gem "bundler", "~> 1.0.0"
gem "calendar_date_select", "1.15"
gem "cancan", "1.2.0"
gem "carmen"
#replace plugin casein?
gem 'casein', '3.1.0'
gem 'comma', '0.4.1'
gem 'exifr'
# factory_girl 1.2.4 wasn't working with Rails 3 - consider an upgrade to factory_girl_rails?
# gem "factory_girl", "1.2.4"
gem 'fastercsv'
gem "geokit"
#need to replace above with below
gem 'geokit-rails'
gem "haml"
gem "hpricot"
gem 'hoptoad_notifier'
gem "jrails"
gem "libxml-ruby", "2.4.0"
gem "memcached", "~> 1.8.0"
#memcached no longer works?
gem 'dalli'
# Not sure why we have this if we're using SQLite3
gem "mysql2", "~> 0.2.6"
#TODO: changed by almazom
gem "rake", "0.8.4"
gem 'recurly'
gem "rdoc"
gem "rmagick"
gem "rspreedly"
gem "rubyzip"
gem 'sass'
# searchlogic not supported for rails3
# gem 'searchlogic'
gem 'rd_searchlogic', :require => 'searchlogic', :git => 'git://github.com/railsdog/searchlogic.git'
#need to use simplecov when upgrading to ruby 2 as rcov doesn't work
gem "simplecov"
gem 'sqlite3'
# tmail no longer included in rails 3?
gem 'tmail'
#need to upgrade will_paginate for casein...?
# gem "will_paginate", "2.3.16"
gem 'will_paginate', '3.0.4'
gem 'yaml_db'
group :development, :test do
gem 'test-unit', '1.2.3'
gem 'rspec', '1.3.2'
gem 'rspec-rails', '~> 1.3.4'
end
group :test do
gem 'capybara', '0.3.5'
gem 'cucumber', '1.1.2'
gem 'cucumber-rails', :git => "git://github.com/RKelln/cucumber-rails.git", :branch => "0.3.2-capybara-fix"
gem 'database_cleaner'
end
And the plugins I have are:
acts-as-favorite-updated
acts_as_configurable
acts_as_follower
better_logging
concerned_with
default_value_for
fast_context
fetcher
has_many_friends
jrails
paperclip
parallel_tests
rails_upgrade
yaml_db
Does anyone have any idea how I can deal with this issue?? :-(

Rspec not working when rails_env=test

When I type this, everything works :
set rails_env=development
rspec spec/models/foo.rb
When I type this, my program get stuck with a deprecation warning :
set rails_env=test
rspec spec/models/foo.rb
->Rack::File headers parameter replaces cache_control after Rack 1.5.
I really need to launch my tests with rails_env=test Do you know what is going on?
Useful infos :
C:\dev>ruby --version
ruby 1.9.3p385 (2013-02-06) [i386-mingw32]
C:\dev>rails --version
Rails 3.2.12
My Gemfile :
source 'https://rubygems.org'
gem 'rails', '3.2.12'
gem 'sqlite3'
gem 'delayed_job_active_record', '= 0.3.3'
gem 'delayed_job', '= 3.0.5'
gem 'clockwork'
gem 'dj_mon'
gem 'libxml-ruby'
gem 'haml-rails'
gem 'log4r'
gem 'spreadsheet'
gem 'mail'
gem "axlsx", "= 2.0.0"
gem 'axlsx_rails'
gem 'ruby-prof'
gem 'test-unit', :require => "test/unit"
gem 'ruby-oci8', '= 2.1.4'
gem 'pg', :require => 'pg'
gem 'devise', '<= 2.2.3'
gem 'cancan', '<= 1.6.9'
gem 'validates_timeliness'
gem 'will_paginate'
gem 'nokogiri'
gem 'simplecov'
gem 'google_visualr'
gem 'thin'
gem 'workflow'
gem 'ruby-graphviz'
gem 'ruby-odbc'
gem 'rubyzip', "= 0.9.9"
gem "rspec-deep-ignore-order-matcher"
gem 'rspec'
gem 'awesome_print'
gem 'syntax'
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
gem 'uglifier', '>= 1.0.3'
end
gem 'jquery-rails', '2.3.0'
group :test, :development do
gem "rspec-rails", "~> 2.0"
end
Update :
I updated my rails version to 3.2.13. The warning disapeared but my app is still stuck.
Update to rails 3.2.13 -- this was a bug fixed
https://github.com/rails/rails/pull/8812
Scroll to the bottom for the closed marker to see the note.
Fixed thanks to koffeinfre.
My test database config had a typo and I didn't know that I had logs into log/test.log.
Also, thanks to trh and Peter Alfvin for pointing out that the deprecation warning was fixed in rails 3.2.13.

Why am I getting this simple error when using `acts_as_taggable_on`?

I wanted to set up ActsAsTaggableOn.strict_case_match = true
According to http://5minutenpause.com/blog/2012/11/20/careful-where-you-get-your-gems-from/, it seems I have to download the gem from github. So I made it that way and tried to run App.
However, it returns this error:(
Error message: (I've tried bundle install but still the same error message!)
git://github.com/mbleigh/acts-as-taggable-on.git (at master) is not checked out. Please run `bundle install` (Bundler::GitError)
Exception class:
PhusionPassenger::UnknownError
Here are my codes!
config/initializer/tag_list.rb
ActsAsTaggableOn.delimiter = ','
ActsAsTaggableOn.remove_unused_tags = true
ActsAsTaggableOn.strict_case_match = true
Gemfile
gem 'acts-as-taggable-on', git: 'git://github.com/mbleigh/acts-as-taggable-on.git'
I made a try to change the source to download the gem directly from to rubyorg, not from the Github. It's just like this.
gem 'acts-as-taggable-on', '2.3.3'
Now it returns this error:(
Error message:
undefined method `strict_case_match=' for ActsAsTaggableOn:Module
How can I solve this?
UPDATE:
Gemfile
source 'https://rubygems.org'
gem 'rails', '3.2.11'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
gem 'mysql2'
gem 'execjs'
gem 'therubyracer'
gem 'devise', '2.0.1'
gem 'recaptcha', :require => 'recaptcha/rails'
gem 'paperclip', "~> 3.0"
gem "cocaine"
gem 'mailboxer', '0.7.0'
gem 'sunspot_rails'
gem 'sunspot_solr'
group :development do
gem 'better_errors'
gem 'binding_of_caller'
#gem 'rack-mini-profiler'
end
gem 'progress_bar'
gem 'kaminari', '0.14.0'
gem "sunspot_with_kaminari", '~> 0.1'
gem 'i18n_generators'
gem 'ancestry'
gem 'acts-as-taggable-on', '2.3.3'
gem 'acts_as_commentable_with_threading'
gem 'twitter-bootstrap-rails'
gem "less-rails"
gem 'crummy', '~> 1.6.0'
gem 'rails3_acts_as_paranoid'
gem 'galetahub-simple_captcha', :require => 'simple_captcha'
gem "acts_as_follower"
gem "jpmobile"
gem "rqrcode-rails3"
gem 'acts_as_votable', '~> 0.4.0'
gem 'rails3-jquery-autocomplete'
gem "cancan"
gem 'rinku', '1.5.1'
gem 'dalli'
gem "auto_html", '1.6.0'
gem "rails_autolink"
# Gems used only for assets and not required
# in production environments by default.
group :assets do
gem 'sass-rails', '~> 3.2.3'
gem 'coffee-rails', '~> 3.2.1'
# See https://github.com/sstephenson/execjs#readme for more supported runtimes
# gem 'therubyracer', :platforms => :ruby
gem 'uglifier', '>= 1.0.3'
gem 'jquery-ui-rails'
end
gem 'jquery-rails'
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'
# To use Jbuilder templates for JSON
# gem 'jbuilder'
# Use unicorn as the app server
# gem 'unicorn'
# Deploy with Capistrano
# gem 'capistrano'
# To use debugger
# gem 'debugger'
The problem is that the version 2.3.3 from acts-as-taggable-on was released 9 months ago and doesn't include the strict_case_match feature.
Your Gemfile has too look this this:
gem 'acts-as-taggable-on', git: 'git://github.com/mbleigh/acts-as-taggable-on.git'
the same way you had, and run:
bundle update acts-as-taggable-on
if that doesn't work, just delete your Gemfile.lock and run bundle install and bundle update
notice that its a development version of the gem, not ready for production, but you can take the risk and be a an alpha user of the gem and report any issue you find :)

bundle install circular dependencies

The following console logs should describe the issue
bundle install
Could not find multi_json-1.1.0 in any of the sources
Run `bundle install` to install missing gems.
bundle install asks me to bundle install.
Have tried: https://github.com/mpapis/rubygems-bundler/issues/4
Looked at: https://github.com/carlhuda/bundler/issues/865
Not sure where to go next.
Also of interest, if we comment all the gems from inside vendor/gems the bundle works fine.
source 'http://rubygems.org'
gem 'rails', '~> 3.2.2'
gem 'mysql2'
gem 'thin'
# Asset template engines
gem 'coffee-script'
gem 'uglifier'
gem 'sprockets'
gem 'less-js'
gem 'execjs'
gem 'nokogiri'
gem 'lucy'
gem 'babilu'
gem 'simple_form'
gem 'mechanize'
gem 'geoip'
gem 'less'
gem 'bb-ruby'
gem 'client_side_validations', "~> 3.2.0.beta.2"
gem 'client_side_validations-simple_form'
gem 'require_all'
#for avatars
gem 'paperclip'
gem 'rmagick'
gem "multipart-post"
gem 'gibberish'
# Memcached client
gem 'dalli'
#to support tables without auto-incrementing primary keys
gem 'composite_primary_keys', "~> 5.0.1"
gem 'calendar_helper', :require => 'calendar_helper'
gem 'jquery-rails'
gem 'capistrano'
gem 'capistrano-ext'
gem 'simple_form'
gem 'htmlentities'
gem 'will_paginate'
gem 'airbrake', :path => "vendor/gems/airbrake"
gem "uservoice", :path => "vendor/gems/uservoice"
# For spambots
gem "honeypot-captcha"
# Internationalization GUI
gem "tolk", :git => "http://github.com/miloops/tolk.git", :branch => "rails31"
gem "will-paginate-i18n"
gem "omniauth"
gem "omniauth-facebook"
gem "omniauth-justintv", :git => 'http://github.com/themindoverall/omniauth-justintv.git'
gem 'oauth'
gem 'rails-i18n'
# For rate limiting
gem "rack-throttle", :path => "vendor/gems/rack-throttle"
gem "xfire-api", :path => "vendor/gems/xfire-api"
gem "anametrix", :path => "vendor/gems/anametrix"
#To make ruby debug work see: http://stackoverflow.com/questions/6438116/rails-with-ruby-debugger-throw-symbol-not-found-ruby-current-thread-loaderro
group :development, :test do
#gem 'ruby-debug-base19', '0.11.26', :path => "~/.rvm/gems/ruby-1.9.3-p#{RUBY_PATCHLEVEL}/gems/ruby-debug-base19-0.11.26/"
#gem 'linecache19', '0.5.13', :path => "~/.rvm/gems/ruby-1.9.3-p#{RUBY_PATCHLEVEL}/gems/linecache19-0.5.13/"
#gem 'ruby-debug19', :require => 'ruby-debug'
gem 'ruby_parser'
end
group :test do
gem 'ruby-prof'
gem 'test-unit' # For performance testing
gem 'turn', :require => false
gem 'factory_girl_rails', "~> 1.0.1"
gem 'capybara', "~> 1.0.0"
gem 'database_cleaner', '~> 0.6.7'
gem 'rspec-rails', "~> 2.6.1"
gem 'cucumber-rails', "~> 1.0.0"
gem 'webrat', "~> 0.7.3"
gem 'autotest'
gem 'simplecov'
gem 'autotest-rails-pure'
gem 'simplecov', :require => false, :group => :test
gem 'spork'
end
group :production do
gem 'rack-google_analytics', :require => "rack/google_analytics"
end
Have you declared that gem in your Gemfile? Sometimes it helps to specify a specific version as you've done for some:
gem 'multi-json', '1.1.0'
If anyone turns out to be stuck on this what turned out to be the answer is one of our homegrown gems:
gem "xfire-api", :path => "vendor/gems/xfire-api"
had a require in it provided by a gem that was not specified in the gemspec. If you're stuck on this and have homegrown gems take a look through all your requires and makes sure all the files are provided by gems you specify in the Gemspec.

Resources