-
Type: Bug
-
Resolution: Done
-
Priority: Major - P3
-
Affects Version/s: 2.0.0
-
Component/s: None
-
None
Mongo::Server::Monitor#ismaster does not disconnect the connection, so the scan/description-update can get stuck on bad connections and will not try to open a new connection to any restarted/recovered server. Also, there are more connection errors that can occur than are handled in the current code.
The following is a possible fix.
class Server class Monitor def ismaster start = Time.now begin result = connection.dispatch([ ISMASTER ]).documents[0] return result, calculate_round_trip_time(start) rescue Mongo::SocketError, Errno::ECONNREFUSED, SystemCallError, IOError => e connection.disconnect! return {}, calculate_round_trip_time(start) rescue Exception => e log(:debug, 'MONGODB', [ "ismaster - unexpected exception #{e} #{e.message}" ]) raise e end end end