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

MongoClient with mongocryptdBypassSpawn still re-executes a mark command

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 3.11.0
    • Affects Version/s: None
    • Component/s: Client Side Encryption
    • None

      On managing mongocryptd the spec says:

      If spawning is necessary, the driver MUST spawn mongocryptd whenever server selection on the MongoClient to mongocryptd fails. If the MongoClient fails to connect after spawning, the server selection error is propagated to the user.

      If the ClientEncryption is configured with mongocryptdBypassSpawn=true, then the driver is not responsible for spawning mongocryptd. If server selection ever fails when connecting to mongocryptd, the server selection error is propagated to the user.

      However java will retry the mongocryptd command even when mongocryptdBypassSpawn=true:

                  try {
                      return executeCommand(databaseName, command);
                  } catch (MongoTimeoutException e) {
                      spawnIfNecesary();
                      return executeCommand(databaseName, command);
                  }
      

      https://github.com/mongodb/mongo-java-driver/blob/e24a0034fb00e3229bb2f867c001df24f555d7c0/driver-sync/src/main/com/mongodb/client/internal/CommandMarker.java#L78-L83

      From my reading of the spec this should be:

                  try {
                      return executeCommand(databaseName, command);
                  } catch (MongoTimeoutException e) {
                      if (processBuilder == null) {  // mongocryptdBypassSpawn=true
                          throw e;
                      }
                      spawnIfNecesary();
                      return executeCommand(databaseName, command);
                  }
      

            Assignee:
            ross@mongodb.com Ross Lawley
            Reporter:
            shane.harvey@mongodb.com Shane Harvey
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: