com.mongodb.MongoException$Network Caused by: java.net.SocketTimeoutException: Read timed out

会有一股神秘感。 提交于 2019-12-24 05:58:42

问题


When I insert documents into Mongo-DB using morphia, it always occur com.mongodb.MongoException$Network: Write operation to server exceptions, maybe interval of one minute The follow is the stack info:

com.mongodb.MongoException$Network: Write operation to server
    at com.mongodb.DBTCPConnector.say(DBTCPConnector.java:153)
    at com.mongodb.DBTCPConnector.say(DBTCPConnector.java:115)
    at com.mongodb.DBApiLayer$MyCollection.update(DBApiLayer.java:327)
    at com.mongodb.DBCollection.update(DBCollection.java:178)
    at com.mongodb.DBCollection.save(DBCollection.java:818)
    at com.google.code.morphia.DatastoreImpl.save(DatastoreImpl.java:882)
    at com.google.code.morphia.DatastoreImpl.save(DatastoreImpl.java:949)
    at com.google.code.morphia.DatastoreImpl.save(DatastoreImpl.java:934)
    at com.yeahmobi.datasystem.conversion.datarepository.mongodb.MongoTransmappingRepository.insert(MongoTransmappingRepository.java:36)
    at com.yeahmobi.datasystem.conversion.datarepository.merge.MergeTransmappingRepository.insert(MergeTransmappingRepository.java:24)
    at com.yeahmobi.datasystem.conversion.threads.JumpInserter.saveJumpLog(JumpInserter.java:134)
    at com.yeahmobi.datasystem.conversion.threads.JumpInserter.run(JumpInserter.java:163)
    at java.lang.Thread.run(Thread.java:662)
Caused by: java.net.SocketTimeoutException: Read timed out
    at java.net.SocketInputStream.socketRead0(Native Method)
    at java.net.SocketInputStream.read(SocketInputStream.java:129)
    at java.io.BufferedInputStream.fill(BufferedInputStream.java:218)
    at java.io.BufferedInputStream.read1(BufferedInputStream.java:258)
    at java.io.BufferedInputStream.read(BufferedInputStream.java:317)
    at org.bson.io.Bits.readFully(Bits.java:46)
    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:142)
    at com.mongodb.DBPort.go(DBPort.java:106)
    at com.mongodb.DBPort.findOne(DBPort.java:162)
    at com.mongodb.DBPort.runCommand(DBPort.java:170)
    at com.mongodb.DBTCPConnector._checkWriteError(DBTCPConnector.java:100)
    at com.mongodb.DBTCPConnector.say(DBTCPConnector.java:142)

Is there anyone meet the same issues? Any sugguestion is appreciated.

Thanks


回答1:


This is unusual and should not happen often during normal operation.

Try to debug from networking/OS perspective, check the following:

  • Is the connectivity between application and Mongo reliable? What's the packet drop rate and latency?
  • Is there enough network bandwidth between application and Mongo?
  • Has there been any software/hardware trouble on the application/Mongo server?
  • Was the server on high load when it happens?


来源:https://stackoverflow.com/questions/21325884/com-mongodb-mongoexceptionnetwork-caused-by-java-net-sockettimeoutexception-r

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!