Rails 5 test server hanging - postgresql

I am in the process of upgrading a Rails 4.2 application to Rails 5.0. We are using capybara-minitest-rails for our feature tests. All of the feature tests are currently timing out. We are using ruby 2.4.2p198.
When using gdb to inspect the process I got the following output:
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
pthread_cond_wait##GLIBC_2.3.2 () at ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S:185
185 ../sysdeps/unix/sysv/linux/x86_64/pthread_cond_wait.S: No such file or directory.
I added ActionDispatch::DebugLocks middleware which gave me the following on /rails/locks
/home/user/.rvm/gems/ruby-2.4.2#jilt/gems/activerecord-5.0.6/lib/active_record/connection_adapters/postgresql_adapter.rb:598:in `async_exec'
/home/user/.rvm/gems/ruby-2.4.2#jilt/gems/activerecord-5.0.6/lib/active_record/connection_adapters/postgresql_adapter.rb:598:in `block in exec_no_cache'
/home/user/.rvm/gems/ruby-2.4.2#jilt/gems/activerecord-5.0.6/lib/active_record/connection_adapters/abstract_adapter.rb:590:in `block in log'
/home/user/.rvm/gems/ruby-2.4.2#jilt/gems/activesupport-5.0.6/lib/active_support/notifications/instrumenter.rb:21:in `instrument'
/home/user/.rvm/gems/ruby-2.4.2#jilt/gems/activerecord-5.0.6/lib/active_record/connection_adapters/abstract_adapter.rb:583:in `log'
...
/home/user/.rvm/gems/ruby-2.4.2#jilt/gems/railties-5.0.6/lib/rails/engine.rb:522:in `call'
/home/user/.rvm/gems/ruby-2.4.2#jilt/gems/puma-3.10.0/lib/puma/configuration.rb:225:in `call'
/home/user/.rvm/gems/ruby-2.4.2#jilt/gems/puma-3.10.0/lib/puma/server.rb:605:in `handle_request'
/home/user/.rvm/gems/ruby-2.4.2#jilt/gems/puma-3.10.0/lib/puma/server.rb:437:in `process_client'
/home/user/.rvm/gems/ruby-2.4.2#jilt/gems/puma-3.10.0/lib/puma/server.rb:301:in `block in run'
/home/user/.rvm/gems/ruby-2.4.2#jilt/gems/puma-3.10.0/lib/puma/thread_pool.rb:120:in `block in spawn_thread'
I have swapped out puma with thin and I still get the same issue. Trying to force puma to run with 1 process and 1 thread, as well as setting eager_load=true have yielded no positive results.

Related

murder integrate with capistrano

when I integrate with murder in capistrano v3.2.1,I add "require 'murder'" in Capfile,and input command "cap production deploy ",then It output the error below:
root#ubuntu:~/deploy# cap production deploy --trace
cap aborted!
NoMethodError: undefined method `instance' for Capistrano::Configuration:Class
/var/lib/gems/1.9.1/gems/murder-0.1.2/lib/murder.rb:17:in `<top (required)>'
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:60:in `require'
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require'
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:35:in `require'
/root/deploy/Capfile:7:in `<top (required)>',
give some details or advice to me,thank you!!!!
I'm pretty sure it's because murder is for capistrano 2, not capistrano 3

`rescue in depend_on': No such file to load -- mongo when running rspec

I'm in the process of updating an app from rails 3.1 to 3.2 and from mongoid 2 to mongoid 3. When I run the application everything runs fine but when I try to run the specs I get the following error (the full stacktrace is at the bottom of this question)
/Users/conor/.rvm/gems/ruby-1.9.3-p484#tm_orig/gems/activesupport-3.2.15/lib/active_support/dependencies.rb:317:in `rescue in depend_on': No such file to load -- mongo (LoadError)
Looking around and at this issue in particular it would seem that this kind of error might be caused by something trying use the mongo driver rather than moped. With this in mind I tried running mongoid-rspec's specs in case it was the culprit but the specs all ran fine. The exact versions of everything being used are list below too
EDIT:
So I was puzzled as to why the the app worked in development and fell over when I tried to run the test code. I ran the tests against the development environment settings without any trouble at all. I had a look at the test and development environment files and discovered that the
config.cache_classes = true
option was causing all the trouble. I changed it to false and I was able to run the test code
I'm happy to have got to the bottom of the problem but I would like to have as good an understanding of what went wrong as possible. If anyone has an insights that they would like to share that would be great
The relevant gem versions:
carrierwave (0.9.0)
carrierwave-mongoid (0.6.3 2beeb87)
factory_girl (2.1.2)
factory_girl_rails (1.2.0)
mongoid (3.1.6)
mongoid-grid_fs (1.3.3)
mongoid-rspec (1.9.0)
mongoid-tree (1.0.4)
moped (1.5.1)
rails (3.2.15)
rspec (2.14.1)
rspec-core (2.14.7)
rspec-expectations (2.14.4)
rspec-mocks (2.14.4)
rspec-rails (2.14.0)
Full stack-trace:
/Users/conor/.rvm/gems/ruby-1.9.3-p484#tm_orig/gems/activesupport-3.2.15/lib/active_support/dependencies.rb:317:in `rescue in depend_on': No such file to load -- mongo (LoadError)
from /Users/conor/.rvm/gems/ruby-1.9.3-p484#tm_orig/gems/activesupport-3.2.15/lib/active_support/dependencies.rb:312:in `depend_on'
from /Users/conor/.rvm/gems/ruby-1.9.3-p484#tm_orig/gems/activesupport-3.2.15/lib/active_support/dependencies.rb:225:in `require_dependency'
from /Users/conor/.rvm/gems/ruby-1.9.3-p484#tm_orig/gems/railties-3.2.15/lib/rails/engine.rb:444:in `block (2 levels) in eager_load!'
from /Users/conor/.rvm/gems/ruby-1.9.3-p484#tm_orig/gems/railties-3.2.15/lib/rails/engine.rb:443:in `each'
from /Users/conor/.rvm/gems/ruby-1.9.3-p484#tm_orig/gems/railties-3.2.15/lib/rails/engine.rb:443:in `block in eager_load!'
from /Users/conor/.rvm/gems/ruby-1.9.3-p484#tm_orig/gems/railties-3.2.15/lib/rails/engine.rb:441:in `each'
from /Users/conor/.rvm/gems/ruby-1.9.3-p484#tm_orig/gems/railties-3.2.15/lib/rails/engine.rb:441:in `eager_load!'
from /Users/conor/.rvm/gems/ruby-1.9.3-p484#tm_orig/gems/railties-3.2.15/lib/rails/application/finisher.rb:53:in `block in <module:Finisher>'
from /Users/conor/.rvm/gems/ruby-1.9.3-p484#tm_orig/gems/railties-3.2.15/lib/rails/initializable.rb:30:in `instance_exec'
from /Users/conor/.rvm/gems/ruby-1.9.3-p484#tm_orig/gems/railties-3.2.15/lib/rails/initializable.rb:30:in `run'
from /Users/conor/.rvm/gems/ruby-1.9.3-p484#tm_orig/gems/railties-3.2.15/lib/rails/initializable.rb:55:in `block in run_initializers'
from /Users/conor/.rvm/gems/ruby-1.9.3-p484#tm_orig/gems/railties-3.2.15/lib/rails/initializable.rb:54:in `each'
from /Users/conor/.rvm/gems/ruby-1.9.3-p484#tm_orig/gems/railties-3.2.15/lib/rails/initializable.rb:54:in `run_initializers'
from /Users/conor/.rvm/gems/ruby-1.9.3-p484#tm_orig/gems/railties-3.2.15/lib/rails/application.rb:136:in `initialize!'
from /Users/conor/.rvm/gems/ruby-1.9.3-p484#tm_orig/gems/railties-3.2.15/lib/rails/railtie/configurable.rb:30:in `method_missing'
from /Users/conor/Documents/dev/orig/TreeMetricsWebApp/config/environment.rb:5:in `<top (required)>'
from /Users/conor/Documents/dev/orig/TreeMetricsWebApp/spec/spec_helper.rb:3:in `require'
from /Users/conor/Documents/dev/orig/TreeMetricsWebApp/spec/spec_helper.rb:3:in `<top (required)>'
from /Users/conor/Documents/dev/orig/TreeMetricsWebApp/spec/models/cross_cut_spec.rb:1:in `require'
from /Users/conor/Documents/dev/orig/TreeMetricsWebApp/spec/models/cross_cut_spec.rb:1:in `<top (required)>'
from /Users/conor/.rvm/gems/ruby-1.9.3-p484#tm_orig/gems/rspec-core-2.14.7/lib/rspec/core/configuration.rb:896:in `load'
from /Users/conor/.rvm/gems/ruby-1.9.3-p484#tm_orig/gems/rspec-core-2.14.7/lib/rspec/core/configuration.rb:896:in `block in load_spec_files'
from /Users/conor/.rvm/gems/ruby-1.9.3-p484#tm_orig/gems/rspec-core-2.14.7/lib/rspec/core/configuration.rb:896:in `each'
from /Users/conor/.rvm/gems/ruby-1.9.3-p484#tm_orig/gems/rspec-core-2.14.7/lib/rspec/core/configuration.rb:896:in `load_spec_files'
from /Users/conor/.rvm/gems/ruby-1.9.3-p484#tm_orig/gems/rspec-core-2.14.7/lib/rspec/core/command_line.rb:22:in `run'
from /Users/conor/.rvm/gems/ruby-1.9.3-p484#tm_orig/gems/rspec-core-2.14.7/lib/rspec/core/runner.rb:80:in `run'
from /Users/conor/.rvm/gems/ruby-1.9.3-p484#tm_orig/gems/rspec-core-2.14.7/lib/rspec/core/runner.rb:17:in `block in autorun'

Gollum Wiki - undefined method `new' for Redcarpet:Module

I'm trying to use Gollumn Wiki, so I could edit my GitHub Wiki but I can't seem to get it to work.
I'm on Ubuntu 11.10, 64Bit.
I've tried this as well with Ruby 1.9, also the same error.
I cloned my GitHub Wiki git repository for my project, fired up Gollum, and this is the error I recieved:
NoMethodError at /
undefined method `new' for Redcarpet:Module
The full stack trace is:
:public is no longer used to avoid overloading Module#public, use :public_folder instead
from /var/lib/gems/1.8/gems/gollum-1.3.1/bin/../lib/gollum/frontend/app.rb:17
[2011-12-06 15:20:15] INFO WEBrick 1.3.1
[2011-12-06 15:20:15] INFO ruby 1.8.7 (2011-06-30) [x86_64-linux]
== Sinatra/1.3.1 has taken the stage on 4567 for development with backup from WEBrick
[2011-12-06 15:20:20] INFO WEBrick::HTTPServer#start: pid=22017 port=4567
NoMethodError - undefined method `new' for Redcarpet:Module:
/var/lib/gems/1.8/gems/gollum-1.3.1/lib/gollum/markup.rb:463:in `render'
/var/lib/gems/1.8/gems/gollum-1.3.1/lib/gollum/page.rb:171:in `formatted_data'
/var/lib/gems/1.8/gems/gollum-1.3.1/bin/../lib/gollum/frontend/app.rb:190:in `show_page_or_file'
/var/lib/gems/1.8/gems/gollum-1.3.1/bin/../lib/gollum/frontend/app.rb:42:in `GET /'
/var/lib/gems/1.8/gems/sinatra-1.3.1/lib/sinatra/base.rb:1211:in `call'
/var/lib/gems/1.8/gems/sinatra-1.3.1/lib/sinatra/base.rb:1211:in `compile!'
/var/lib/gems/1.8/gems/sinatra-1.3.1/lib/sinatra/base.rb:772:in `[]'
/var/lib/gems/1.8/gems/sinatra-1.3.1/lib/sinatra/base.rb:772:in `route!'
/var/lib/gems/1.8/gems/sinatra-1.3.1/lib/sinatra/base.rb:788:in `route_eval'
/var/lib/gems/1.8/gems/sinatra-1.3.1/lib/sinatra/base.rb:772:in `route!'
/var/lib/gems/1.8/gems/sinatra-1.3.1/lib/sinatra/base.rb:821:in `process_route'
/var/lib/gems/1.8/gems/sinatra-1.3.1/lib/sinatra/base.rb:819:in `catch'
/var/lib/gems/1.8/gems/sinatra-1.3.1/lib/sinatra/base.rb:819:in `process_route'
/var/lib/gems/1.8/gems/sinatra-1.3.1/lib/sinatra/base.rb:771:in `route!'
/var/lib/gems/1.8/gems/sinatra-1.3.1/lib/sinatra/base.rb:770:in `each'
/var/lib/gems/1.8/gems/sinatra-1.3.1/lib/sinatra/base.rb:770:in `route!'
/var/lib/gems/1.8/gems/sinatra-1.3.1/lib/sinatra/base.rb:886:in `dispatch!'
/var/lib/gems/1.8/gems/sinatra-1.3.1/lib/sinatra/base.rb:706:in `call!'
/var/lib/gems/1.8/gems/sinatra-1.3.1/lib/sinatra/base.rb:871:in `invoke'
/var/lib/gems/1.8/gems/sinatra-1.3.1/lib/sinatra/base.rb:871:in `catch'
/var/lib/gems/1.8/gems/sinatra-1.3.1/lib/sinatra/base.rb:871:in `invoke'
/var/lib/gems/1.8/gems/sinatra-1.3.1/lib/sinatra/base.rb:706:in `call!'
/var/lib/gems/1.8/gems/sinatra-1.3.1/lib/sinatra/base.rb:692:in `call'
/var/lib/gems/1.8/gems/rack-protection-1.1.4/lib/rack/protection/xss_header.rb:22:in `call'
/var/lib/gems/1.8/gems/rack-protection-1.1.4/lib/rack/protection/path_traversal.rb:16:in `call'
/var/lib/gems/1.8/gems/rack-protection-1.1.4/lib/rack/protection/json_csrf.rb:17:in `call'
/var/lib/gems/1.8/gems/rack-protection-1.1.4/lib/rack/protection/base.rb:47:in `call'
/var/lib/gems/1.8/gems/rack-protection-1.1.4/lib/rack/protection/xss_header.rb:22:in `call'
/var/lib/gems/1.8/gems/rack-1.3.5/lib/rack/nulllogger.rb:9:in `call'
/var/lib/gems/1.8/gems/rack-1.3.5/lib/rack/head.rb:9:in `call'
/var/lib/gems/1.8/gems/sinatra-1.3.1/lib/sinatra/showexceptions.rb:21:in `call'
/var/lib/gems/1.8/gems/sinatra-1.3.1/lib/sinatra/base.rb:1334:in `call'
/var/lib/gems/1.8/gems/sinatra-1.3.1/lib/sinatra/base.rb:1403:in `synchronize'
/var/lib/gems/1.8/gems/sinatra-1.3.1/lib/sinatra/base.rb:1334:in `call'
/var/lib/gems/1.8/gems/rack-1.3.5/lib/rack/handler/webrick.rb:59:in `service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:104:in `service'
/usr/lib/ruby/1.8/webrick/httpserver.rb:65:in `run'
/usr/lib/ruby/1.8/webrick/server.rb:173:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:162:in `start_thread'
/usr/lib/ruby/1.8/webrick/server.rb:95:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `each'
/usr/lib/ruby/1.8/webrick/server.rb:92:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:23:in `start'
/usr/lib/ruby/1.8/webrick/server.rb:82:in `start'
/var/lib/gems/1.8/gems/rack-1.3.5/lib/rack/handler/webrick.rb:13:in `run'
/var/lib/gems/1.8/gems/sinatra-1.3.1/lib/sinatra/base.rb:1295:in `run!'
/var/lib/gems/1.8/gems/gollum-1.3.1/bin/gollum:125
/usr/local/bin/gollum:19:in `load'
/usr/local/bin/gollum:19
Any help would be appreciated.
Try reinstalling redcarpet like this:
gem uninstall redcarpet
gem install redcarpet --version=1.17.2
If using bundler, put in your Gemfile
gem 'redcarpet', '1.17.2'
gem 'gollum'
I am trying to use Gollum as my documentation for new projects and this problem hit me recently also. To solve this I isolated the changes using Bundler. In my cloned Gollum directory on my local machine I did the following:
# Create a Gemfile with the following:
source "http://rubygems.org"
gem 'redcarpet', '1.17.2'
gem 'gollum'
Next just run bundle install to set everything up. When you are ready to start the gollum server run bundle exec gollum from the command line.
This will give you a nice isolated gollum server using the gems you specifically bundled and will solve this problem discussed in your question.
I got the same "undefined method 'new' for Redcarpet:Module" error after running a bundle update.
Similar to above, this installed version 2 of the gem along side version 1. I could have gone back to v1 as described above, but since I"m not actually using a system that required the first gen of the gem, I removed version 1 and went with v2. Easy.

Taps error exporting DB to Heroku

I'm trying to pull my postgres db into Heroku from windows. I run
$app_folder> heroku db:push postgres://postgres:password#localhost/db_name
It sends the schema correctly and some data to the tables but then I got the following error.
19 tables, 1,835 records
Saving session to push_201110201435.dat..
!!! Caught Server Exception
HTTP CODE: 500
Taps Server Error: LoadError: no such file to load -- sequel/adapters/
["/app/.bundle/gems/ruby/1.9.1/gems/sequel-3.20.0/lib/sequel/core.rb:249:in `req
uire'", "/app/.bundle/gems/ruby/1.9.1/gems/sequel-3.20.0/lib/sequel/core.rb:249:
in `block in tsk_require'", "/app/.bundle/gems/ruby/1.9.1/gems/sequel-3.20.0/lib
/sequel/core.rb:72:in `block in check_requiring_thread'", "<internal:prelude>:10
:in `synchronize'", "/app/.bundle/gems/ruby/1.9.1/gems/sequel-3.20.0/lib/sequel/
core.rb:69:in `check_requiring_thread'", "/app/.bundle/gems/ruby/1.9.1/gems/sequ
el-3.20.0/lib/sequel/core.rb:249:in `tsk_require'", "/app/.bundle/gems/ruby/1.9.
1/gems/sequel-3.20.0/lib/sequel/database/connecting.rb:25:in `adapter_class'", "
/app/.bundle/gems/ruby/1.9.1/gems/sequel-3.20.0/lib/sequel/database/connecting.r
b:54:in `connect'", "/app/.bundle/gems/ruby/1.9.1/gems/sequel-3.20.0/lib/sequel/
core.rb:119:in `connect'", "/app/lib/taps/db_session.rb:14:in `conn'", "/app/lib
/taps/server.rb:91:in `block in <class:Server>'", "/app/.bundle/gems/ruby/1.9.1/
gems/sinatra-1.0/lib/sinatra/base.rb:865:in `call'", "/app/.bundle/gems/ruby/1.9
.1/gems/sinatra-1.0/lib/sinatra/base.rb:865:in `block in route'", "/app/.bundle/
gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:521:in `instance_eval'", "/
app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:521:in `route_e
val'", "/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:500:in
`block (2 levels) in route!'", "/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/l
ib/sinatra/base.rb:497:in `catch'", "/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1
.0/lib/sinatra/base.rb:497:in `block in route!'", "/app/.bundle/gems/ruby/1.9.1/
gems/sinatra-1.0/lib/sinatra/base.rb:476:in `each'", "/app/.bundle/gems/ruby/1.9
.1/gems/sinatra-1.0/lib/sinatra/base.rb:476:in `route!'", "/app/.bundle/gems/rub
y/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:601:in `dispatch!'", "/app/.bundle/
gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:411:in `block in call!'", "
/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:566:in `instan
ce_eval'", "/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:56
6:in `block in invoke'", "/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sina
tra/base.rb:566:in `catch'", "/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0/lib/
sinatra/base.rb:566:in `invoke'", "/app/.bundle/gems/ruby/1.9.1/gems/sinatra-1.0
/lib/sinatra/base.rb:411:in `call!'", "/app/.bundle/gems/ruby/1.9.1/gems/sinatra
-1.0/lib/sinatra/base.rb:399:in `call'", "/app/.bundle/gems/ruby/1.9.1/gems/rack
-1.2.1/lib/rack/auth/basic.rb:25:in `call'", "/app/.bundle/gems/ruby/1.9.1/gems/
sinatra-1.0/lib/sinatra/base.rb:979:in `block in call'", "/app/.bundle/gems/ruby
/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:1005:in `synchronize'", "/app/.bundl
e/gems/ruby/1.9.1/gems/sinatra-1.0/lib/sinatra/base.rb:979:in `call'", "/home/he
roku_rack/lib/static_assets.rb:9:in `call'", "/home/heroku_rack/lib/last_access.
rb:15:in `call'", "/app/.bundle/gems/ruby/1.9.1/gems/rack-1.2.1/lib/rack/urlmap.
rb:47:in `block in call'", "/app/.bundle/gems/ruby/1.9.1/gems/rack-1.2.1/lib/rac
k/urlmap.rb:41:in `each'", "/app/.bundle/gems/ruby/1.9.1/gems/rack-1.2.1/lib/rac
k/urlmap.rb:41:in `call'", "/home/heroku_rack/lib/date_header.rb:14:in `call'",
"/app/.bundle/gems/ruby/1.9.1/gems/rack-1.2.1/lib/rack/builder.rb:77:in `call'",
"/app/.bundle/gems/ruby/1.9.1/gems/thin-1.2.7/lib/thin/connection.rb:76:in `blo
ck in pre_process'", "/app/.bundle/gems/ruby/1.9.1/gems/thin-1.2.7/lib/thin/conn
ection.rb:74:in `catch'", "/app/.bundle/gems/ruby/1.9.1/gems/thin-1.2.7/lib/thin
/connection.rb:74:in `pre_process'", "/app/.bundle/gems/ruby/1.9.1/gems/thin-1.2
.7/lib/thin/connection.rb:57:in `process'", "/app/.bundle/gems/ruby/1.9.1/gems/t
hin-1.2.7/lib/thin/connection.rb:42:in `receive_data'", "/app/.bundle/gems/ruby/
1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `run_machine'", "/app
/.bundle/gems/ruby/1.9.1/gems/eventmachine-0.12.10/lib/eventmachine.rb:256:in `r
un'", "/app/.bundle/gems/ruby/1.9.1/gems/thin-1.2.7/lib/thin/backends/base.rb:57
:in `start'", "/app/.bundle/gems/ruby/1.9.1/gems/thin-1.2.7/lib/thin/server.rb:1
56:in `start'", "/app/.bundle/gems/ruby/1.9.1/gems/thin-1.2.7/lib/thin/controlle
rs/controller.rb:80:in `start'", "/app/.bundle/gems/ruby/1.9.1/gems/thin-1.2.7/l
ib/thin/runner.rb:177:in `run_command'", "/app/.bundle/gems/ruby/1.9.1/gems/thin
-1.2.7/lib/thin/runner.rb:143:in `run!'", "/app/.bundle/gems/ruby/1.9.1/gems/thi
n-1.2.7/bin/thin:6:in `<top (required)>'", "/usr/ruby1.9.2/bin/thin:19:in `load'
", "/usr/ruby1.9.2/bin/thin:19:in `<main>'"]
As said before I'm running Windows and I have the following gems installed locally:
addressable (2.2.6)
heroku (2.9.0)
launchy (2.0.5)
mime-types (1.16)
minitest (2.6.1, 1.6.0)
pg (0.11.0 x86-mingw32)
rack (1.3.5)
rake (0.9.2, 0.8.7)
rdoc (2.5.8)
rest-client (1.6.7)
rubyzip (0.9.4)
sequel (3.28.0, 3.20.0)
sinatra (1.0)
sqlite3 (1.3.4 x86-mingw32)
sqlite3-ruby (1.3.3)
taps (0.3.23)
term-ansicolor (1.0.7)
I found this thread on Github but it didn't solve my issue: https://github.com/ricardochimal/taps/issues/86
Can anyone help?
Thanks
A lot of time after searching and trying some things I noticed that I didn't add the database addon. (Heroku states that every application comes with database so I didn't figure out I had to activate the addon)
A simple:
heroku addons:add shared-database
Solved everything.
Hope it helps anyone
Assuming you've added a database and you're still having this problem make sure you have at least 1 Dyno running and you've promoted your database.
To promote a database, first get the name of it by running:
heroku pg
It will be called something like HEROKU_POSTGRESQL_COLOR_URL, then just promote it:
heroku pg:promote HEROKU_POSTGRESQL_COLOR_URL
This will allow you to access that database via the DATABASE_URL environment variable, which is what the db:push command uses to push to.

MongoMapper, MongoDB and EventMachine

I am using DaemonKit to create an AMQP listener. Whenever a message comes across the wire, I would like to log it to MongoDB. I have moved my Rails MongoDB configs over and the connection works fine. When I try to create a new model, I get an error in the Model.create method.
IOError when attempting to close socket connected to localhost:27017: #<IOError: closed stream>
/Users/lfaus/.rvm/gems/ruby-1.9.2-p180/gems/mongo-1.3.1/lib/mongo/connection.rb:856:in `rescue in send_message_on_socket': Operation failed with the following exception: closed stream (Mongo::ConnectionFailure)
from /Users/lfaus/.rvm/gems/ruby-1.9.2-p180/gems/mongo-1.3.1/lib/mongo/connection.rb:843:in `send_message_on_socket'
from /Users/lfaus/.rvm/gems/ruby-1.9.2-p180/gems/mongo-1.3.1/lib/mongo/connection.rb:483:in `block in receive_message'
from <internal:prelude>:10:in `synchronize'
from /Users/lfaus/.rvm/gems/ruby-1.9.2-p180/gems/mongo-1.3.1/lib/mongo/connection.rb:482:in `receive_message'
from /Users/lfaus/.rvm/gems/ruby-1.9.2-p180/gems/mongo-1.3.1/lib/mongo/cursor.rb:407:in `block in send_initial_query'
from /Users/lfaus/.rvm/gems/ruby-1.9.2-p180/gems/mongo-1.3.1/lib/mongo/connection.rb:609:in `instrument'
from /Users/lfaus/.rvm/gems/ruby-1.9.2-p180/gems/mongo-1.3.1/lib/mongo/cursor.rb:406:in `send_initial_query'
from /Users/lfaus/.rvm/gems/ruby-1.9.2-p180/gems/mongo-1.3.1/lib/mongo/cursor.rb:371:in `refresh'
from /Users/lfaus/.rvm/gems/ruby-1.9.2-p180/gems/mongo-1.3.1/lib/mongo/cursor.rb:87:in `next_document'
from /Users/lfaus/.rvm/gems/ruby-1.9.2-p180/gems/mongo-1.3.1/lib/mongo/cursor.rb:248:in `each'
from /Users/lfaus/.rvm/gems/ruby-1.9.2-p180/gems/mongo-1.3.1/lib/mongo/cursor.rb:267:in `to_a'
from /Users/lfaus/.rvm/gems/ruby-1.9.2-p180/gems/mongo-1.3.1/lib/mongo/cursor.rb:267:in `to_a'
from /Users/lfaus/.rvm/gems/ruby-1.9.2-p180/gems/plucky-0.3.8/lib/plucky/query.rb:76:in `all'
from /Volumes/External/Projects/ruby/alertsdaemons/eventmachine/libexec/eventmachine-daemon.rb:17:in `block in <top (required)>'
from /Volumes/External/Projects/ruby/alertsdaemons/eventmachine/libexec/eventmachine-daemon.rb:15:in `loop'
from /Volumes/External/Projects/ruby/alertsdaemons/eventmachine/libexec/eventmachine-daemon.rb:15:in `<top (required)>'
from /Users/lfaus/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:in `require'
from /Users/lfaus/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:in `block in require'
from /Users/lfaus/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:225:in `block in load_dependency'
from /Users/lfaus/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:596:in `new_constants_in'
from /Users/lfaus/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:225:in `load_dependency'
from /Users/lfaus/.rvm/gems/ruby-1.9.2-p180/gems/activesupport-3.0.7/lib/active_support/dependencies.rb:239:in `require'
from /Users/lfaus/.rvm/gems/ruby-1.9.2-p180/gems/daemon-kit-0.1.8.2/lib/daemon_kit/application.rb:38:in `run'
from /Users/lfaus/.rvm/gems/ruby-1.9.2-p180/gems/daemon-kit-0.1.8.2/lib/daemon_kit/application.rb:21:in `exec'
from /Volumes/External/Projects/ruby/alertsdaemons/eventmachine/bin/eventmachine:12:in `<top (required)>'
from -e:1:in `load'
from -e:1:in `<main>'
code for creating the object:
# Sample loop to show process
loop do
DaemonKit.logger.info "I'm running"
message = Message.create({
:first_name => 'Lee',
:last_name => 'Faus'
})
puts message.inspect
puts message.count
sleep 5
end
I had read that I could fork mongomapper to make the http calls async, but these errors seem to be coming from the mongodb ruby driver. any help is greatly appreciated.
It is tough to say what is really happening here, but I have a suspicion that I'd like you to investigate please.
Ensure you are establishing your Mongo connection in a POST-daemonize config, instead of a PRE-daemonize config. DaemonKit forks after the PRE-initializers and the mongo connection will need to be re-established at this point in time. This goes for any IO of any kind, after forking they all need to be re-opened.
The same logic holds true for ActiveRecord in a daemonized project. If this was ActiveRecord you could do something like this:
config/pre-daemonize/database.rb
ActiveRecord::Base.establish_connection(:foo => 'bar')
config/post-daemonize/database.rb
ActiveRecord::Base.verify_active_connections!
I'm not a mongomapper user, so I don't know how to translate the above example.
My best advise is to "ping" mongo in PRE-daemonization phase and error out if it failed, so the daemon doesn't even start, and the properly setup the connection in a post-daemonize configuration.