The CentOS Error use "service td-agent status" - centos

I use td-agent in CentOS.
When I typed "service td-agent start", I saw "Starting td-agent: [ OK ]".
To check it, I typed "service td-agent status", but I saw "td-agent dead but pid file exists".
I don't understand this result.
Please tell me how to solve this.
more
when I typed "service td-agent start", I saw this messages.
Starting td-agent: /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.39/lib/fluent/supervisor.rb:30:in `initialize': Permission denied - /var/log/td-agent/td-agent.log (Errno::EACCES)
from /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.39/lib/fluent/supervisor.rb:30:in `open'
from /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.39/lib/fluent/supervisor.rb:30:in `init'
from /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.39/lib/fluent/supervisor.rb:79:in `start'
from /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.39/lib/fluent/command/fluentd.rb:141:in `<top (required)>'
from /usr/lib64/fluent/ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /usr/lib64/fluent/ruby/lib/ruby/1.9.1/rubygems/custom_require.rb:55:in `require'
from /usr/lib64/fluent/ruby/lib/ruby/gems/1.9.1/gems/fluentd-0.10.39/bin/fluentd:6:in `<top (required)>'
from /usr/lib64/fluent/ruby/bin/fluentd:23:in `load'
from /usr/lib64/fluent/ruby/bin/fluentd:23:in `<top (required)>'
from /usr/sbin/td-agent:7:in `load'
from /usr/sbin/td-agent:7:in `<main>'
[FAILED]

Looks like the permission issue but you can still check the following link to install and properly configure td-agent on http://docs.treasure-data.com/articles/td-agent
It has also installation notes for redhat/centos/ubuntu.
Thanks & Regards,
Alok Thaker

In addition to checking permissions as suggested above, delete your pid file before you restart td-agent. The pid file tracks the process ID for td-agent when you start the service. If yours isn't located at /var/run/td-agent/ then check /etc/init.d/td-agent and look for something like $PIDFILE

Related

Error reported when using Pod to access CallKits SDK of ZEGOCLOUD

I want to use ZEGOCLOUD's Call Kits SDK. When I access it according to their development documentation, Pod install reports an error.
Podfile:
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
target 'CallKitsDemo' do
# Comment the next line if you don't want to use dynamic frameworks
use_frameworks!
# Pods for CallKitsDemo
pod 'ZegoUIKitPrebuiltCall'
pod 'ZegoUIKitSignalingPlugin'
end
Error after executing Pod install
Analyzing dependencies
/Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/user_interface/error_report.rb:34:in `force_encoding': can't modify frozen String (FrozenError)
from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/user_interface/error_report.rb:34:in `report'
from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/command.rb:66:in `report_error'
from /Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:396:in `handle_exception'
from /Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:337:in `rescue in run'
from /Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:324:in `run'
from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/command.rb:52:in `run'
from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/bin/pod:55:in `<top (required)>'
from /usr/local/bin/pod:23:in `load'
from /usr/local/bin/pod:23:in `<main>'
/Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.21.0/lib/xcodeproj/project.rb:228:in `initialize_from_file': [Xcodeproj] Unknown object version (56). (RuntimeError)
from /Library/Ruby/Gems/2.6.0/gems/xcodeproj-1.21.0/lib/xcodeproj/project.rb:113:in `open'
from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/installer/analyzer.rb:1190:in `block (2 levels) in inspect_targets_to_integrate'
from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/installer/analyzer.rb:1189:in `each'
from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.11.3/lib/cocoapods/installer/analyzer.rb:1189:in `block in inspect_targets_to_integrate'
This is because Ruby has compatibility issues with the latest version of Xcode, and you need to set the project's format to support earlier versions of Xcode.

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.

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.