Skip to content

Instantly share code, notes, and snippets.

@ryana

ryana/Script output

Created Oct 12, 2009
Embed
What would you like to do?
# Modified reconnect file
require 'rubygems'
$LOAD_PATH[0,0] = File.join(File.dirname(__FILE__), '..', 'lib')
require 'mongo'
db = Mongo::Connection.new(:auto_reconnect => true).db("ruby_test")
db['test'].clear
10.times do |i|
db['test'].save("x" => i)
end
while true do
begin
exit() if not db['test'].count() == 10
x = 0
db['test'].find().each do |doc|
x += doc['x']
end
exit() if not x == 45
print "."
STDOUT.flush
sleep 1
rescue => e
puts e.to_s
puts e.backtrace[0..5].join("\n")
sleep 1
end
end
ra:bin ryan$ ./mongod --dbpath .
Mon Oct 12 16:06:11 Mongo DB : starting : pid = 28548 port = 27017 dbpath = . master = 0 slave = 0 64-bit
Mon Oct 12 16:06:11 db version v1.0.0, pdfile version 4.4
Mon Oct 12 16:06:11 git version: dabf2ce54614c6de9d728af445eec47f39dde19f
Mon Oct 12 16:06:11 sys info: Darwin ERH-OFC-MP.local 9.6.0 Darwin Kernel Version 9.6.0: Mon Nov 24 17:37:00 PST 2008; root:xnu-1228.9.59~1/RELEASE_I386 i386
Mon Oct 12 16:06:11 waiting for connections on port 27017
Mon Oct 12 16:06:11 web admin interface listening on port 28017
Mon Oct 12 16:06:13 connection accepted from 127.0.0.1:5582 #1
^CMon Oct 12 16:06:18 got kill or ctrl c signal 2 (Interrupt), will terminate after current cmd ends
Mon Oct 12 16:06:18 now exiting
Mon Oct 12 16:06:18 dbexit:
Mon Oct 12 16:06:18 Listener on port 28017 aborted.
Mon Oct 12 16:06:18 Listener on port 27017 aborted
Mon Oct 12 16:06:18 MessagingPort recv() error "Bad file descriptor" (9) 127.0.0.1:5582
Mon Oct 12 16:06:18 closeAllFiles() finished
Mon Oct 12 16:06:18 end connection 127.0.0.1:5582
Mon Oct 12 16:06:18 dbexit: really exiting now
ra:bin ryan$ ./mongod --dbpath .
Mon Oct 12 16:06:23 Mongo DB : starting : pid = 28550 port = 27017 dbpath = . master = 0 slave = 0 64-bit
Mon Oct 12 16:06:23 db version v1.0.0, pdfile version 4.4
Mon Oct 12 16:06:23 git version: dabf2ce54614c6de9d728af445eec47f39dde19f
Mon Oct 12 16:06:23 sys info: Darwin ERH-OFC-MP.local 9.6.0 Darwin Kernel Version 9.6.0: Mon Nov 24 17:37:00 PST 2008; root:xnu-1228.9.59~1/RELEASE_I386 i386
Mon Oct 12 16:06:23 waiting for connections on port 27017
Mon Oct 12 16:06:23 web admin interface listening on port 28017
ra:~ ryan$ ruby reconnect.rb
......Connection reset by peer - recvfrom(2)
/Library/Ruby/Gems/1.8/gems/mongo-0.15.1/lib/mongo/db.rb:349:in `recv'
/Library/Ruby/Gems/1.8/gems/mongo-0.15.1/lib/mongo/db.rb:349:in `receive_full'
/Library/Ruby/Gems/1.8/gems/mongo-0.15.1/lib/mongo/message/message_header.rb:31:in `read_header'
/Library/Ruby/Gems/1.8/gems/mongo-0.15.1/lib/mongo/cursor.rb:206:in `read_message_header'
/Library/Ruby/Gems/1.8/gems/mongo-0.15.1/lib/mongo/cursor.rb:194:in `read_all'
/Library/Ruby/Gems/1.8/gems/mongo-0.15.1/lib/mongo/cursor.rb:277:in `send_query_if_needed'
Broken pipe
/Library/Ruby/Gems/1.8/gems/mongo-0.15.1/lib/mongo/db.rb:507:in `write'
/Library/Ruby/Gems/1.8/gems/mongo-0.15.1/lib/mongo/db.rb:507:in `print'
/Library/Ruby/Gems/1.8/gems/mongo-0.15.1/lib/mongo/db.rb:507:in `send_to_db'
/Library/Ruby/Gems/1.8/gems/mongo-0.15.1/lib/mongo/db.rb:372:in `send_query_message'
/Library/Ruby/Gems/1.8/gems/mongo-0.15.1/lib/mongo/cursor.rb:275:in `send_query_if_needed'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/mutex_m.rb:67:in `synchronize'
private method `print' called for nil:NilClass
/Library/Ruby/Gems/1.8/gems/mongo-0.15.1/lib/mongo/db.rb:507:in `send_to_db'
/Library/Ruby/Gems/1.8/gems/mongo-0.15.1/lib/mongo/db.rb:372:in `send_query_message'
/Library/Ruby/Gems/1.8/gems/mongo-0.15.1/lib/mongo/cursor.rb:275:in `send_query_if_needed'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/mutex_m.rb:67:in `synchronize'
/Library/Ruby/Gems/1.8/gems/mongo-0.15.1/lib/mongo/db.rb:541:in `_synchronize'
/Library/Ruby/Gems/1.8/gems/mongo-0.15.1/lib/mongo/cursor.rb:274:in `send_query_if_needed'
private method `print' called for nil:NilClass
/Library/Ruby/Gems/1.8/gems/mongo-0.15.1/lib/mongo/db.rb:507:in `send_to_db'
/Library/Ruby/Gems/1.8/gems/mongo-0.15.1/lib/mongo/db.rb:372:in `send_query_message'
/Library/Ruby/Gems/1.8/gems/mongo-0.15.1/lib/mongo/cursor.rb:275:in `send_query_if_needed'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/mutex_m.rb:67:in `synchronize'
/Library/Ruby/Gems/1.8/gems/mongo-0.15.1/lib/mongo/db.rb:541:in `_synchronize'
/Library/Ruby/Gems/1.8/gems/mongo-0.15.1/lib/mongo/cursor.rb:274:in `send_query_if_needed'
private method `print' called for nil:NilClass
/Library/Ruby/Gems/1.8/gems/mongo-0.15.1/lib/mongo/db.rb:507:in `send_to_db'
/Library/Ruby/Gems/1.8/gems/mongo-0.15.1/lib/mongo/db.rb:372:in `send_query_message'
/Library/Ruby/Gems/1.8/gems/mongo-0.15.1/lib/mongo/cursor.rb:275:in `send_query_if_needed'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/mutex_m.rb:67:in `synchronize'
/Library/Ruby/Gems/1.8/gems/mongo-0.15.1/lib/mongo/db.rb:541:in `_synchronize'
/Library/Ruby/Gems/1.8/gems/mongo-0.15.1/lib/mongo/cursor.rb:274:in `send_query_if_needed'
#
# Server Restarted Here
#
private method `print' called for nil:NilClass
/Library/Ruby/Gems/1.8/gems/mongo-0.15.1/lib/mongo/db.rb:507:in `send_to_db'
/Library/Ruby/Gems/1.8/gems/mongo-0.15.1/lib/mongo/db.rb:372:in `send_query_message'
/Library/Ruby/Gems/1.8/gems/mongo-0.15.1/lib/mongo/cursor.rb:275:in `send_query_if_needed'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/mutex_m.rb:67:in `synchronize'
/Library/Ruby/Gems/1.8/gems/mongo-0.15.1/lib/mongo/db.rb:541:in `_synchronize'
/Library/Ruby/Gems/1.8/gems/mongo-0.15.1/lib/mongo/cursor.rb:274:in `send_query_if_needed'
private method `print' called for nil:NilClass
/Library/Ruby/Gems/1.8/gems/mongo-0.15.1/lib/mongo/db.rb:507:in `send_to_db'
/Library/Ruby/Gems/1.8/gems/mongo-0.15.1/lib/mongo/db.rb:372:in `send_query_message'
/Library/Ruby/Gems/1.8/gems/mongo-0.15.1/lib/mongo/cursor.rb:275:in `send_query_if_needed'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/mutex_m.rb:67:in `synchronize'
/Library/Ruby/Gems/1.8/gems/mongo-0.15.1/lib/mongo/db.rb:541:in `_synchronize'
/Library/Ruby/Gems/1.8/gems/mongo-0.15.1/lib/mongo/cursor.rb:274:in `send_query_if_needed'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment