java.io.IOException

There are no available Samebug tips for this exception. Do you have an idea how to solve this issue? A short tip would help users who saw this issue last week.

  • Have the following codes: try { db = mongo.getDb("lp"); coll = db.getCollection("lp.mrtest"); if (enable_limit) { cur = coll.find(query).limit(20).addOption( Bytes.QUERYOPTION_SLAVEOK); } else { cur = coll.find(query).addOption(Bytes.QUERYOPTION_SLAVEOK); } size = enable_limit ? cur.itcount() : cur.size(); } catch (Exception ex) { System.out.println("count: get exception " + ex); ex.printStackTrace(); db = mongo.getDb("lp"); coll = db.getCollection("lp.mrtest"); if (enable_limit) { cur = coll.find(query).limit(20).addOption( Bytes.QUERYOPTION_SLAVEOK); } else { cur = coll.find(query).addOption(Bytes.QUERYOPTION_SLAVEOK); } size = enable_limit ? cur.itcount() : cur.size(); System.out.println("count: get " + size); } catch (Throwable t) { System.out.println("count: get thowable " + t); t.printStackTrace(); db = mongo.getDb("lp"); coll = db.getCollection("lp.mrtest"); if (enable_limit) { cur = coll.find(query).limit(20).addOption( Bytes.QUERYOPTION_SLAVEOK); } else { cur = coll.find(query).addOption(Bytes.QUERYOPTION_SLAVEOK); } size = enable_limit ? cur.itcount() : cur.size(); System.out.println("count: get " + size); } Testing failover by issuing kill -9 on the primary node. Cannot seem to be able to catch exception s.t. I can retry the query. java.io.IOException: couldn't connect to [ip-10-166-59-166/10.166.59.166:20000] bc:java.net.ConnectException: Connection refused at com.mongodb.DBPort._open(DBPort.java:205) at com.mongodb.DBPort.go(DBPort.java:85) at com.mongodb.DBPort.go(DBPort.java:66) at com.mongodb.DBPort.call(DBPort.java:56) at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:211) at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:284) at com.mongodb.DBCursor._check(DBCursor.java:297) at com.mongodb.DBCursor._hasNext(DBCursor.java:420) at com.mongodb.DBCursor.hasNext(DBCursor.java:445) at com.mongodb.DBCursor.itcount(DBCursor.java:535) at com.leadpoint.db.MongoDbQueryPerformanceTest.getCount(MongoDbQueryPerformanceTest.java:101) at com.leadpoint.db.MongoDbQueryPerformanceTest.main(MongoDbQueryPerformanceTest.java:255) Nov 4, 2010 4:03:26 PM com.mongodb.DBTCPConnector$MyPort error SEVERE: MyPort.error called java.io.IOException: couldn't connect to [ip-10-166-59-166/10.166.59.166:20000] bc:java.net.ConnectException: Connection refused at com.mongodb.DBPort._open(DBPort.java:205) at com.mongodb.DBPort.go(DBPort.java:85) at com.mongodb.DBPort.go(DBPort.java:66) at com.mongodb.DBPort.call(DBPort.java:56) at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:211) at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:284) at com.mongodb.DBCursor._check(DBCursor.java:297) at com.mongodb.DBCursor._hasNext(DBCursor.java:420) at com.mongodb.DBCursor.hasNext(DBCursor.java:445) at com.mongodb.DBCursor.itcount(DBCursor.java:535)
    via by Joseph Wang,
  • Plugin fails without mongodb
    via GitHub by ignatov
    ,
    • java.io.IOException: couldn't connect to [ip-10-166-59-166/10.166.59.166:20000] bc:java.net.ConnectException: Connection refused at com.mongodb.DBPort._open(DBPort.java:205) at com.mongodb.DBPort.go(DBPort.java:85) at com.mongodb.DBPort.go(DBPort.java:66) at com.mongodb.DBPort.call(DBPort.java:56) at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:211) at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:284) at com.mongodb.DBCursor._check(DBCursor.java:297) at com.mongodb.DBCursor._hasNext(DBCursor.java:420) at com.mongodb.DBCursor.hasNext(DBCursor.java:445) at com.mongodb.DBCursor.itcount(DBCursor.java:535)

    Users with the same issue

    abrazenebabrazeneb
    688 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor2 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,