Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-33542

Using maxTime() on MongoDB 3.4 and 3.6 does not yield the same error code

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: 3.6.0, 3.6.3
    • Fix Version/s: 3.6.4, 3.7.4
    • Component/s: Querying
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Backport Requested:
      v3.6
    • Steps To Reproduce:
      Hide

      use test
      db.test.insert({a: 1})
      db.test.find({$where: "sleep(101)"}).maxTimeMS(100)
      

      Show
      use test db.test.insert({a: 1}) db.test.find({$where: "sleep(101)"}).maxTimeMS(100)
    • Sprint:
      Query 2018-03-12, Query 2018-03-26

      Description

      Using maxTime() does not yield the same exception when accessing a MongoDB deployment. It seems that timeouts now throw an error code 96 instead of 50 in recent versions of the MongoDB server.

      In the Java driver it makes the driver throw a MongoQueryException instead of a MongoExecutionTimeoutException.

      Sample Java code:

      MongoDatabase db = (new MongoClient()).getDatabase("foo");
      MongoCollection<Document> coll = db.getCollection("bar");
      coll.insertOne(new Document());
      coll.find(Filters.eq("$where", "sleep(100)")).maxTime(100, TimeUnit.MILLISECONDS).first();
      

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              charlie.swanson Charlie Swanson
              Reporter:
              charles.sarrazin Charles Sarrazin (Inactive)
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              11 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: