com.mongodb.MongoSocketReadException

If you like a tip written by other Samebug users, mark is as helpful! Marks help our algorithm provide you better solutions and also help other users.
tip

Check if your server is listening to the the same adress you're trying to connect to.

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

  • BigDecimal on save - error
    via GitHub by fa-at-pulsit
    ,
  • I am trying to unlock a locked 3.x database. {code:java} public static void unlockMongoDB(MongoClient m) throws Exception { String context = "MongoDBHelper-unlockMongoDB: "; Logger.info(context + "Checking if MongoDB instance needs to be unlocked"); if(m.isLocked()) { Logger.info(context + "Unlocking MongoDB instance"); m.unlock(); } } {code} isLocked() fails with the following stack trace {noformat} 13 Jul 2015 02:20:20,893 ERROR ~ Prematurely reached end of stream 13 Jul 2015 02:20:20,894 ERROR ~ com.mongodb.MongoSocketReadException: Prematurely reached end of stream at com.mongodb.connection.SocketStream.read(SocketStream.java:88) at com.mongodb.connection.InternalStreamConnection.receiveResponseBuffers(InternalStreamConnection.java:491) at com.mongodb.connection.InternalStreamConnection.receiveMessage(InternalStreamConnection.java:221) at com.mongodb.connection.UsageTrackingInternalConnection.receiveMessage(UsageTrackingInternalConnection.java:102) at com.mongodb.connection.DefaultConnectionPool$PooledConnection.receiveMessage(DefaultConnectionPool.java:416) at com.mongodb.connection.QueryProtocol.receiveMessage(QueryProtocol.java:282) at com.mongodb.connection.QueryProtocol.execute(QueryProtocol.java:229) at com.mongodb.connection.QueryProtocol.execute(QueryProtocol.java:38) at com.mongodb.connection.DefaultServer$DefaultServerProtocolExecutor.execute(DefaultServer.java:155) at com.mongodb.connection.DefaultServerConnection.executeProtocol(DefaultServerConnection.java:219) at com.mongodb.connection.DefaultServerConnection.query(DefaultServerConnection.java:166) at com.mongodb.operation.FindOperation$1.call(FindOperation.java:397) at com.mongodb.operation.FindOperation$1.call(FindOperation.java:394) at com.mongodb.operation.OperationHelper.withConnectionSource(OperationHelper.java:195) at com.mongodb.operation.OperationHelper.withConnection(OperationHelper.java:168) at com.mongodb.operation.FindOperation.execute(FindOperation.java:394) at com.mongodb.operation.FindOperation.execute(FindOperation.java:57) at com.mongodb.Mongo.execute(Mongo.java:738) at com.mongodb.Mongo$2.execute(Mongo.java:725) at com.mongodb.DBCollection.findOne(DBCollection.java:737) at com.mongodb.DBCollection.findOne(DBCollection.java:710) at com.mongodb.DBCollection.findOne(DBCollection.java:657) at com.mongodb.DBCollection.findOne(DBCollection.java:646) at com.mongodb.Mongo.isLocked(Mongo.java:574) {noformat} Also I have noticed that if I pass the MongoClient object to another function and unlock it, the unlock appears to hang. If I use a try {} finally {} and unlock, it appears to go through.
    via by Dharshan Rangegowda,
  • new cluster install failing
    via by john tombin,
  • I am trying to unlock a locked 3.x database. {code:java} public static void unlockMongoDB(MongoClient m) throws Exception { String context = "MongoDBHelper-unlockMongoDB: "; Logger.info(context + "Checking if MongoDB instance needs to be unlocked"); if(m.isLocked()) { Logger.info(context + "Unlocking MongoDB instance"); m.unlock(); } } {code} isLocked() fails with the following stack trace {noformat} 13 Jul 2015 02:20:20,893 ERROR ~ Prematurely reached end of stream 13 Jul 2015 02:20:20,894 ERROR ~ com.mongodb.MongoSocketReadException: Prematurely reached end of stream at com.mongodb.connection.SocketStream.read(SocketStream.java:88) at com.mongodb.connection.InternalStreamConnection.receiveResponseBuffers(InternalStreamConnection.java:491) at com.mongodb.connection.InternalStreamConnection.receiveMessage(InternalStreamConnection.java:221) at com.mongodb.connection.UsageTrackingInternalConnection.receiveMessage(UsageTrackingInternalConnection.java:102) at com.mongodb.connection.DefaultConnectionPool$PooledConnection.receiveMessage(DefaultConnectionPool.java:416) at com.mongodb.connection.QueryProtocol.receiveMessage(QueryProtocol.java:282) at com.mongodb.connection.QueryProtocol.execute(QueryProtocol.java:229) at com.mongodb.connection.QueryProtocol.execute(QueryProtocol.java:38) at com.mongodb.connection.DefaultServer$DefaultServerProtocolExecutor.execute(DefaultServer.java:155) at com.mongodb.connection.DefaultServerConnection.executeProtocol(DefaultServerConnection.java:219) at com.mongodb.connection.DefaultServerConnection.query(DefaultServerConnection.java:166) at com.mongodb.operation.FindOperation$1.call(FindOperation.java:397) at com.mongodb.operation.FindOperation$1.call(FindOperation.java:394) at com.mongodb.operation.OperationHelper.withConnectionSource(OperationHelper.java:195) at com.mongodb.operation.OperationHelper.withConnection(OperationHelper.java:168) at com.mongodb.operation.FindOperation.execute(FindOperation.java:394) at com.mongodb.operation.FindOperation.execute(FindOperation.java:57) at com.mongodb.Mongo.execute(Mongo.java:738) at com.mongodb.Mongo$2.execute(Mongo.java:725) at com.mongodb.DBCollection.findOne(DBCollection.java:737) at com.mongodb.DBCollection.findOne(DBCollection.java:710) at com.mongodb.DBCollection.findOne(DBCollection.java:657) at com.mongodb.DBCollection.findOne(DBCollection.java:646) at com.mongodb.Mongo.isLocked(Mongo.java:574) {noformat} Also I have noticed that if I pass the MongoClient object to another function and unlock it, the unlock appears to hang. If I use a try {} finally {} and unlock, it appears to go through.
    via by Dharshan Rangegowda,
    • com.mongodb.MongoSocketReadException: Prematurely reached end of stream at com.mongodb.connection.SocketStream.read(SocketStream.java:88) at com.mongodb.connection.InternalStreamConnection.receiveResponseBuffers(InternalStreamConnection.java:494) at com.mongodb.connection.InternalStreamConnection.receiveMessage(InternalStreamConnection.java:224) at com.mongodb.connection.UsageTrackingInternalConnection.receiveMessage(UsageTrackingInternalConnection.java:96) at com.mongodb.connection.DefaultConnectionPool$PooledConnection.receiveMessage(DefaultConnectionPool.java:440) at com.mongodb.connection.WriteCommandProtocol.receiveMessage(WriteCommandProtocol.java:262) at com.mongodb.connection.WriteCommandProtocol.execute(WriteCommandProtocol.java:104) at com.mongodb.connection.InsertCommandProtocol.execute(InsertCommandProtocol.java:67) at com.mongodb.connection.InsertCommandProtocol.execute(InsertCommandProtocol.java:37) at com.mongodb.connection.DefaultServer$DefaultServerProtocolExecutor.execute(DefaultServer.java:168) at com.mongodb.connection.DefaultServerConnection.executeProtocol(DefaultServerConnection.java:289) at com.mongodb.connection.DefaultServerConnection.insertCommand(DefaultServerConnection.java:118) at com.mongodb.operation.InsertOperation.executeCommandProtocol(InsertOperation.java:76) at com.mongodb.operation.BaseWriteOperation$1.call(BaseWriteOperation.java:139) at com.mongodb.operation.BaseWriteOperation$1.call(BaseWriteOperation.java:133) at com.mongodb.operation.OperationHelper.withConnectionSource(OperationHelper.java:422) at com.mongodb.operation.OperationHelper.withConnection(OperationHelper.java:413) at com.mongodb.operation.BaseWriteOperation.execute(BaseWriteOperation.java:133) at com.mongodb.operation.BaseWriteOperation.execute(BaseWriteOperation.java:60) at com.mongodb.Mongo.execute(Mongo.java:845) at com.mongodb.Mongo$2.execute(Mongo.java:828) at com.mongodb.DBCollection.executeWriteOperation(DBCollection.java:342) at com.mongodb.DBCollection.insert(DBCollection.java:337) at com.mongodb.DBCollection.insert(DBCollection.java:328) at org.mongodb.morphia.DatastoreImpl.saveDocument(DatastoreImpl.java:1297) at org.mongodb.morphia.DatastoreImpl.tryVersionedUpdate(DatastoreImpl.java:1340) at org.mongodb.morphia.DatastoreImpl.save(DatastoreImpl.java:1286) at org.mongodb.morphia.DatastoreImpl.save(DatastoreImpl.java:775) at org.mongodb.morphia.DatastoreImpl.save(DatastoreImpl.java:758)

    Users with the same issue

    rsprangemeijerrsprangemeijer
    2 times, last one,
    poroszdporoszd
    1 times, last one,
    Unknown visitor
    Unknown visitor2 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    Unknown visitor
    Unknown visitor1 times, last one,
    9 more bugmates