[JAVA-2395] com.mongodb.MongoException$CursorNotFound: cursor not found on server Created: 24/Nov/16 Updated: 09/Feb/18 Resolved: 24/Nov/16 |
|
| Status: | Closed |
| Project: | Java Driver |
| Component/s: | API |
| Affects Version/s: | 3.0.4 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Major - P3 |
| Reporter: | Jaipal Reddy | Assignee: | Ross Lawley |
| Resolution: | Done | Votes: | 0 |
| Labels: | Bug | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Description |
|
Hello Team, Exception com.mongodb.MongoCursorNotFoundException: Query failed with error code -5 and error message 'Cursor 43249415092 not found on server xx.xx.xx.xx:27017' We are unable to find the cause since we are getting this rarely |
| Comments |
| Comment by Swapnil Srivastav [ 09/Feb/18 ] |
|
@Jaipal Reddy |
| Comment by Ross Lawley [ 24/Nov/16 ] |
|
Looks like the code is in the internal JDK java.net.SocketInputStream.socketRead0 method and no exceptions have been propagated back to the driver. There have JDK bugs reported for this issue but it seems it might be JDK dependent. Ross |
| Comment by Jaipal Reddy [ 24/Nov/16 ] |
|
Hii Ross, Thank you for the quick response. We had another issue. In cases where our application is unable to read data from cursor and we hadn't received any exception,We took the thread dump and found that the thread reading data getting stuck in RUNNABLE state. Following is the thread dump. java.lang.Thread.State: RUNNABLE Why the driver is not throwing any exception? |
| Comment by Ross Lawley [ 24/Nov/16 ] |
|
Hi jaipal_543, Thanks for the ticket. Idle cursors are automatically timed out by the server, if an application calls for more results on a timed out cursor then you will get a CursorNotFound exception. The default timeout is 10 minutes but can be configured via the cursorTimeoutMillis parameter. You can also turn off cursor timeouts in the Java API via DBCursor#addOption and passing the QUERYOPTION_NOTIMEOUT value. However, care should be taken as after setting the noCursorTimeout option, you must either close the cursor manually with cursor.close() or by exhausting the cursor’s results. I hope that helps, Ross |