java.io.EOFException

JIRA | Alex | 4 years ago
  1. 0

    Hello I am using Mongo Java Driver 2.10.1 and I am trying to reconfigure a replica set configuration by using Mongo Java Driver. Initially I have four Mongo servers started up with next configuration: {code} { "_id" : "rs-test", "version" : 1, members : [ {_id : 0, host : "localhost:27017"}, {_id : 1, host : "localhost:27018"}, {_id : 2, host : "localhost:27019"}, {_id : 3, host : "localhost:27020"} ] } {code} Then I have my test which tries to reconfig this replica set by sending next document: {code} { "_id" : "rs-test", "version" : 2, members : [ {_id : 0, host : "localhost:27017"}, {_id : 1, host : "localhost:27018"}, {_id : 2, host : "localhost:27019"}, {_id : 3, host : "localhost:27020", arbiterOnly: true} ] } {code} And Java code: {code} MongoClient mongoClient = new MongoClient("localhost", 27017); BasicDBObject basicDBObject = new BasicDBObject(); basicDBObject.put("replSetReconfig",JSON.parse(DOCUMENT)); DB db = mongoClient.getDB("admin"); CommandResult command = db.command(basicDBObject); System.out.println(command); {code} And then next exception is returned: {code} emptying DBPortPool to localhost/127.0.0.1:27017 b/c of error java.io.EOFException at org.bson.io.Bits.readFully(Bits.java:48) at org.bson.io.Bits.readFully(Bits.java:33) at org.bson.io.Bits.readFully(Bits.java:28) at com.mongodb.Response.<init>(Response.java:40) at com.mongodb.DBPort.go(DBPort.java:124) at com.mongodb.DBPort.call(DBPort.java:74) at com.mongodb.DBTCPConnector.innerCall(DBTCPConnector.java:286) at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:257) at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:310) at com.mongodb.DB.command(DB.java:274) at com.mongodb.DB.command(DB.java:256) at com.mongodb.DB.command(DB.java:313) at com.mongodb.DB.command(DB.java:211) at MyTest.test(MyTest.java:32) at MyTest.main(MyTest.java:40) Exception in thread "main" com.mongodb.MongoException$Network: can't call something : localhost/127.0.0.1:27017/admin at com.mongodb.DBTCPConnector.innerCall(DBTCPConnector.java:295) at com.mongodb.DBTCPConnector.call(DBTCPConnector.java:257) at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:310) at com.mongodb.DB.command(DB.java:274) at com.mongodb.DB.command(DB.java:256) at com.mongodb.DB.command(DB.java:313) at com.mongodb.DB.command(DB.java:211) at MyTest.test(MyTest.java:32) at MyTest.main(MyTest.java:40) Caused by: java.io.EOFException at org.bson.io.Bits.readFully(Bits.java:48) at org.bson.io.Bits.readFully(Bits.java:33) at org.bson.io.Bits.readFully(Bits.java:28) at com.mongodb.Response.<init>(Response.java:40) at com.mongodb.DBPort.go(DBPort.java:124) at com.mongodb.DBPort.call(DBPort.java:74) at com.mongodb.DBTCPConnector.innerCall(DBTCPConnector.java:286) ... 8 more {code} If I go to mongo shell and I type rs.conf() at first time an errno:2 is also shown but then tries to reconnect again and then it works as expected and shows that server with id 3 is hidden. So it seems like command is send successful. Is there any way to avoid that Mongo Driver throws an exception? Maybe me as a user of Mongo Java Driver should implement a recovery function? (basically catching the exception and not propagating it?). Also I have tried by registering all servers in MongoClient but same exception is thrown. Thank you very much in advance for your help.

    JIRA | 4 years ago | Alex
    java.io.EOFException
  2. 0

    stack trace on programmatic shutdown from Java driver 2.6.2

    Google Groups | 6 years ago | Nathan Tippy
    java.io.EOFException
  3. Speed up your debug routine!

    Automated exception search integrated into your IDE

  4. 0

    Java streams with EOFException

    Stack Overflow | 4 years ago | user2224638
    java.io.EOFException

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. java.io.EOFException

      No message provided

      at org.bson.io.Bits.readFully()
    2. MongoDB Java Driver
      DB.command
      1. org.bson.io.Bits.readFully(Bits.java:48)
      2. org.bson.io.Bits.readFully(Bits.java:33)
      3. org.bson.io.Bits.readFully(Bits.java:28)
      4. com.mongodb.Response.<init>(Response.java:40)
      5. com.mongodb.DBPort.go(DBPort.java:124)
      6. com.mongodb.DBPort.call(DBPort.java:74)
      7. com.mongodb.DBTCPConnector.innerCall(DBTCPConnector.java:286)
      8. com.mongodb.DBTCPConnector.call(DBTCPConnector.java:257)
      9. com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:310)
      10. com.mongodb.DB.command(DB.java:274)
      11. com.mongodb.DB.command(DB.java:256)
      12. com.mongodb.DB.command(DB.java:313)
      13. com.mongodb.DB.command(DB.java:211)
      13 frames
    3. Unknown
      MyTest.main
      1. MyTest.test(MyTest.java:32)
      2. MyTest.main(MyTest.java:40)
      2 frames