MongoDB read timee out exception Solution

Source: Internet
Author: User

Complete exception information:

Org. springframework. dao. dataaccessresourcefailureexception: Can't call something:/172.16.9.54: 27017/Mo; Nested exception is com. mongoDB. except exception $ Network: Can't call something:/172.16.9.54: 27017/ Mo at org. springframework. Data. MongoDB. Core. exceptiontranslator. translateexceptionifpossible (exceptiontranslator. Java: 56 ) At org. springframework. Data. MongoDB. Core. Partition template. potentiallyconvertruntimeexception (partition template. Java: 1546 ) At org.springframework.data.mongodb.core.w.template.exe cutefindmultiinternal (using template. Java: 1450 ) At org. springframework. Data. MongoDB. Core. mongotemplate. dofind (mongotemplate. Java: 1248) At org. springframework. Data. MongoDB. Core. mongotemplate. dofind (mongotemplate. Java: 1234 ) At org. springframework. Data. MongoDB. Core. mongotemplate. Find (mongotemplate. Java: 471 ) At com. sitech. Persistent. phonebillmanagerimpl. querymosmsobjlist (phonebillmanagerimpl. Java: 144 ) At com. sitech. Mas. periodtask. impl. smsmophonebilltask. processtask (smsmophonebilltask. Java: 29 ) At com. sitech. Mas. periodtask. periodtaskhandler. dotask (periodtaskhandler. Java: 20) At sun. Reflect. generatedmethodaccessor70.invoke (unknown source) at Sun. Reflect. delegatingmethodaccessorimpl. Invoke (delegatingmethodaccessorimpl. Java: 25 ) At java. Lang. Reflect. method. Invoke (method. Java: 597 ) At org. springframework. Scheduling. Support. scheduledmethodrunnable. Run (scheduledmethodrunnable. Java: 64 ) At org. springframework. Scheduling. Support. delegatingerrorhandlingrunnable. Run (delegatingerrorhandlingrunnable. Java: 53 ) At java. util. Concurrent. executors $ runnableadapter. Call (executors. Java: 441 ) At java. util. Concurrent. futuretask $ sync. innerrunandreset (futuretask. Java: 317 ) At java. util. Concurrent. futuretask. runandreset (futuretask. Java: 150 ) At java. util. Concurrent. scheduledthreadpoolexecutor $ scheduledfuturetask. Access $ 101 (scheduledthreadpoolexecutor. Java: 98 ) At java. util. Concurrent. scheduledthreadpoolexecutor $ scheduledfuturetask. runperiodic (scheduledthreadpoolexecutor. Java: 181 ) At java. util. Concurrent. scheduledthreadpoolexecutor $ scheduledfuturetask. Run (scheduledthreadpoolexecutor. Java: 205 ) At java. util. Concurrent. threadpoolexecutor $ worker. runtask (threadpoolexecutor. Java: 886) At java. util. Concurrent. threadpoolexecutor $ worker. Run (threadpoolexecutor. Java: 908 ) At java. Lang. thread. Run (thread. Java: 619 ) Caused by: COM. MongoDB. mongoexception $ Network: Can 'T call something:/172.16.9.54: 27017/Mo at com. MongoDB. dbtcpconnector. innercall (dbtcpconne. Java: 292 ) At com. MongoDB. dbtcpconnector. Call (dbtcpconne. Java: 256 ) At com. MongoDB. dbapilayer $ mycollection. _ Find (dbapilayer. Java: 289 ) At com. MongoDB. dbapilayer $ mycollection. _ Find (dbapilayer. Java: 274) 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.w.template.exe cutefindmultiinternal (using template. Java: 1444 )... 20 Morecaused 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: 124 ) At com. MongoDB. dbport. Call (dbport. Java: 74 ) At com. MongoDB. dbtcpconnector. innercall (dbtcpconnector. Java: 283 )... 27 more

The final read timed out is the key
The exception occurs because no results are returned after a long period of time for data operations.

Solution: Set sockettimeout

The spring configuration is as follows:

<Mongo: OptionsConnections-per-host= "500"Socket-Timeout= "5000"Max-wait-time= "5000"Threads-allowed-to-block-for-connection-multiplier= "1000"Connect-Timeout= "30000"/>

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.