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

Repeated CursorNotFound exceptions on long-running process following oplog

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.10.1
    • Component/s: None
    • Labels:
      None
    • Environment:
      RHEL 6.x86_64

      The custom oplog follower we're using creates a tailable cursor as follows:

      mongo.getDB("foo").getCollection("bar").find(criteria).limit(0).skip(0)
      .hint(new BasicDBObject("$natural", 1))
      .addOption(Bytes.QUERYOPTION_TAILABLE)
      .addOption(Bytes.QUERYOPTION_AWAITDATA)
      .addOption(Bytes.QUERYOPTION_NOTIMEOUT);

      After a couple million writes to the database, the cursor throws an exception like this:

      com.mongodb.MongoException$CursorNotFound: cursor 0 not found on server localhost/127.0.0.1:10120
      at com.mongodb.DBApiLayer$Result.init(DBApiLayer.java:394)
      at com.mongodb.DBApiLayer$Result._advance(DBApiLayer.java:454)
      at com.mongodb.DBApiLayer$Result.hasNext(DBApiLayer.java:421)
      at com.mongodb.DBCursor._hasNext(DBCursor.java:464)
      at com.mongodb.DBCursor.hasNext(DBCursor.java:484)

      The process waits a second and then attempts to create a new cursor, using the same method. This succeeds, but the same exception is thrown 5-10 seconds later. Once the initial exception is thrown, subsequent exceptions occur very frequently (the initial exception may take a long time to occur after the process starts). This exception occurs so frequently, that our process falls far behind in processing oplog entries.

            Assignee:
            Unassigned Unassigned
            Reporter:
            dcardon@adobe.com David Cardon
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: