What causes SocketException (9001) handling request in node.js app and MongoDB ReplicaSet? -
i have simple node.js application makes single call connection call replicaset. things working fine earlier today , nothing changed in application, connection failing (silently) , i'm seeing following in mongod logs.
thu apr 18 17:16:56 [conn1782026] end connection 10.x.x.x:50720 (40 connections open) thu apr 18 17:16:57 [initandlisten] connection accepted 10.x.x.x:50721 #1782027 (41 connections open) thu apr 18 17:16:57 [initandlisten] connection accepted 10.x.x.x:50722 #1782028 (42 connections open) thu apr 18 17:16:57 [initandlisten] connection accepted 10.x.x.x:50723 #1782029 (43 connections open) thu apr 18 17:16:57 [initandlisten] connection accepted 10.x.x.x:50724 #1782030 (44 connections open) thu apr 18 17:16:57 [initandlisten] connection accepted 10.x.x.x:50725 #1782031 (45 connections open) thu apr 18 17:16:57 [initandlisten] connection accepted 10.x.x.x:50736 #1782032 (46 connections open) [conn1782028] socketexception handling request, closing client connection: 9001 socket exception [2] server [10.x.x.x:50722] i haven't been able track down causes or how fix it.
here's connection code:
var _ = require("underscore"); var db_options = { db:{ w:1, native_parser: false }, server:{ auto_reconnect:true, socketoptions: {} }, replset:{ rs_name: "my_replset_name", readpreference: "secondary" }, mongos: {} }; db.client.connect("mongodb://server1:27017,server2:27017,server3:27017/my_database", db_options, function(err, _db){ if(err){ console.log(err); }else{ _db.collection("my_collection", function(err, collection){ collection.find({q:1}).toarray(function(err,item){ if(err){ console.log(err); }else{ _.each(item, function(r){ if(!_.isempty(r)){ // item! console.log(r._id); } }); console.log("finished."); } }); }); } }); i'm running replicaset on ec2 , can connect each otherhave simple node.js application makes single call connection call replicaset - said, worked , stopped working without notice.
does have insights this? causes it? how prevent it? how fix it?
if os rhel5.x, default system parameter
net.ipv4.tcp_mem=196608 262144 393216
change to:
net.ipv4.tcp_mem=786432 1048576 1572864
4k(perpage) * 1572864(page)=6g (max tcp memory), default 1.5g
Comments
Post a Comment