MongoCursor - maxTime - TimeoutException is thrown after wrong period of time

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Done
    • Priority: Minor - P4
    • None
    • Affects Version/s: 3.2.2
    • Component/s: API
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Please have a look at following code snipped:

      MongoDatabase db = mongoClient.getDatabase("local");
      MongoCollection<Document> oplogCollection = db.getCollection("oplog.$main");
      
      MongoCursor<Document> cursor = oplogCollection.find(aFilter())
                      .cursorType(CursorType.Tailable)
                      //will throw MongoExecutionTimeoutException after ~ 10s -30s
                      .maxTime(300, MILLISECONDS)
                      .iterator();
      
      //following code will produce an exception after like 10-30s:
      cursor.hasNext(); 
      

      I tried to implement this functionality using cursor type=TailableAwait and maxAwaitTile(300, MILLISECONDS) but in such case code was just freezing without any timeout.

            Assignee:
            Ross Lawley
            Reporter:
            Krzysztof Barczyk
            None
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: