2014년 11월 29일 토요일

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

I need help for below issue.
We are getting the
following Exception repeatedly while read and write from
db.
org.springframework.dao.DataAccessResourceFailureException: Read
operation
to server /192.168.9.125:27017 failed on database IPSA;
ne
sted exception is com.mongodb.MongoException$Network: Read operation
to
server /192.168.9.125:27017 failed on database IPSA
at
org.springframework.data.mongodb.core.MongoExceptionTranslator.translateExceptionIfPossible(MongoExceptionTranslator.java
:56)
at
org.springframework.data.mongodb.core.MongoTemplate.potentiallyConvertRuntimeException(MongoTemplate.java:1665)
at
org.springframework.data.mongodb.core.MongoTemplate.executeFindMultiInternal(MongoTemplate.java:1548)
at
org.springframework.data.mongodb.core.MongoTemplate.doFind(MongoTemplate.java:1336)
at
org.springframework.data.mongodb.core.MongoTemplate.doFind(MongoTemplate.java:1322)
at
org.springframework.data.mongodb.core.MongoTemplate.find(MongoTemplate.java:495)
at
org.springframework.data.mongodb.core.MongoTemplate.find(MongoTemplate.java:486)
at
in.rishoncomm.gen.objectStore.mongodb.DBOperation.find(DBOperation.java:49)
at
in.rishoncomm.gen.objectStore.mongodb.DBOperation.getAllObjects(DBOperation.java:38)
at
in.co.nmsworks.ip.pms.computation.SubKpiComputation.getLastComputedTimeFromDB(SubKpiComputation.java:271)
at
in.co.nmsworks.ip.pms.computation.SubKpiComputation.getLastComputedTime(SubKpiComputation.java:242)
at
in.co.nmsworks.ip.pms.computation.SubKpiComputation.computeSubKpi(SubKpiComputation.java:112)
at
in.co.nmsworks.ip.pms.computation.ComputeServer$PerformanceDataListener$PmsComputation.run(ComputeServer.java:199)
at
java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)
at
java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)
at
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
Caused by:
com.mongodb.MongoException$Network: Read operation to
server
/192.168.9.125:27017 failed on database IPSA
at
com.mongodb.DBTCPConnector.innerCall(DBTCPConnector.java:253)
at
com.mongodb.DBTCPConnector.call(DBTCPConnector.java:216)
at
com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:288)
at
com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:273)
at
com.mongodb.DBCursor._check(DBCursor.java:368)
at
com.mongodb.DBCursor._hasNext(DBCursor.java:459)
at
com.mongodb.DBCursor.hasNext(DBCursor.java:484)
at
org.springframework.data.mongodb.core.MongoTemplate.executeFindMultiInternal(MongoTemplate.java:1534)
... 24 more
Caused by: java.net.SocketTimeoutException: Read timed out
at java.net.SocketInputStream.socketRead0(Native Method)
at
java.net.SocketInputStream.read(SocketInputStream.java:152)
at
java.net.SocketInputStream.read(SocketInputStream.java:122)
at
java.io.BufferedInputStream.fill(BufferedInputStream.java:235)
at
java.io.BufferedInputStream.read1(BufferedInputStream.java:275)
at
java.io.BufferedInputStream.read(BufferedInputStream.java:334)
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.(Response.java:40)
at
com.mongodb.DBPort.go(DBPort.java:142)
at
com.mongodb.DBPort.call(DBPort.java:92)
at
com.mongodb.DBTCPConnector.innerCall(DBTCPConnector.java:244)
... 31
more

And mongo configuration,

<mongo:mongo host="192.168.9.125" port="27017">
        <mongo:options connections-per-host="100"
            threads-allowed-to-block-for-connection-multiplier="5"
            connect-timeout="20000" max-wait-time="20000" auto-connect-retry="true"
            socket-keep-alive="true" socket-timeout="30000" slave-ok="true"
            write-number="1" write-timeout="0" write-fsync="true" />
    </mongo:mongo>

Query also indexed.

Db and application are in LAN connection.

currnet Load Average of DB server is 13.



You should probably check on network issues since that's where the error seems to be pointing to...



Thank you for your reply. Application and DB are in LAN. 
Ping is also good at the time of exception.



I started application In local host. Same exception is happened after some time.



Both Application and DB are in Localhost. Same kind of Exception occurred in local host. Is there any issue with OS?. 



Can you check the server logs?  (mongod logs) - it's possible there are hints there about what might be going on.



There is no directory like /var/log/mongo/. Because I am starting Mongod with extracted tar file  which has mongod in bin directory. So I will set the appropriate configuration, and then update logs. 



The logs *always* go somewhere.
It's not possible to start mongod without the logs going either to the console or to a file (specified by --logpath if you are starting it from command line).
Yes I just start with command-line. The command  like
bin$  ./mongod --dbpath somepath &
I didn't mention logpath
That's not a proper way to start any daemon and mongod in particular - you are basically attaching the process to the console and then backgrounding it. If you want to start it on the command line, use --fork (and then it requires you use --logpath to send the logs to a file).

댓글 없음:

댓글 쓰기