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

MongoClient with mongocryptdBypassSpawn still re-executes a mark command

    XMLWordPrintable

    Details

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

      Description

      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);
                  }
      

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: