Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-2538

MongoCursorNotFoundException almost immediately after query.

    XMLWordPrintableJSON

Details

    • Icon: Bug Bug
    • Resolution: Works as Designed
    • Icon: Major - P3 Major - P3
    • None
    • None
    • None
    • None
    • CentOS 7 with sharded cluster running mongo 3.4

    Description

      Hello,

      We are getting MongoCursorNotFoundException almost immediately (about 1-2 seconds) after running a find query. To give a little more info, in our code we run a find and then grab the iterator from the FindIterable and run through the items in a while loop.

      I put in some logs and found that after the find is run, while it's looping through, after 01.670seconds, it threw the exception below. 10 minutes after this occurs, in the mongos logs the cursor is closed for idle timeout.

      The only thing I can think of for a possible cause is, we have 6 machines that have mongos running and each of the application servers use a round robin styled DNS resolver to resolve the mongos URL. Would this setup cause a problem for the mongo connection?

      Stacktrace:

      Caused by: com.mongodb.MongoCursorNotFoundException: Query failed with error code -5 and error message 'Cursor 692999830626020539 not found on server mongos:27276' on server mongos:27276
      at com.mongodb.operation.QueryHelper.translateCommandException(QueryHelper.java:27)
      at com.mongodb.operation.QueryBatchCursor.getMore(QueryBatchCursor.java:213)
      at com.mongodb.operation.QueryBatchCursor.hasNext(QueryBatchCursor.java:103)
      at com.mongodb.MongoBatchCursorAdapter.hasNext(MongoBatchCursorAdapter.java:46)
      

      Please let me know if you need any additional information.

      Attachments

        Activity

          People

            Unassigned Unassigned
            min.choi@ad-juster.com Min Choi
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: