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.
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.
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'
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.
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.