igrigorik/em-synchrony — Issue #99: MongoDB Socket Exception breaks inserts
Author: tobyhede
Created: 2011-12-25 02:21:39+00:00
State: open

Run into a weird one.

I cannot insert when using 'em-synchrony/em-mongo' , but I can read.

My insert code is pretty much lifted from the specs:

EventMachine.synchrony do
db = EM::Mongo::Connection.new("localhost", 27017).db('hot_test')
collection = db.collection('test')

collection.insert(:name => 'two', :position => 1)
EventMachine.stop
end

I can insert using the 'regular' em-mongo gem with EventMachine.

I am seeing a SocketException in the mongo log.

Sun Dec 25 13:15:42 [initandlisten] connection accepted from 127.0.0.1:51392 #4
Sun Dec 25 13:15:42 [conn4] Socket recv() conn closed? 127.0.0.1:51392
Sun Dec 25 13:15:42 [conn4] SocketException: remote: 127.0.0.1:51392 error: 9001 socket exception [0] server [127.0.0.1:51392]
Sun Dec 25 13:15:42 [conn4] end connection 127.0.0.1:51392

This Exception also occurs when reading, but the values the read works:

Sun Dec 25 13:13:37 [initandlisten] connection accepted from 127.0.0.1:51378 #2
Sun Dec 25 13:13:37 [conn2] runQuery called hot_test.test {}
Sun Dec 25 13:13:37 [conn2] used cursor: 0x102603a70
Sun Dec 25 13:13:37 [conn2] query hot_test.test nreturned:1 reslen:70 0ms
Sun Dec 25 13:13:37 [conn2] Socket recv() conn closed? 127.0.0.1:51378
Sun Dec 25 13:13:37 [conn2] SocketException: remote: 127.0.0.1:51378 error: 9001 socket exception [0] server [127.0.0.1:51378]

Using MongoDB v2.0.1 on OS X.