[JAVA-3359] MongoClient with mongocryptdBypassSpawn still re-executes a mark command Created: 22/Jul/19  Updated: 28/Oct/23  Resolved: 25/Jul/19

Status: Closed
Project: Java Driver
Component/s: Client Side Encryption
Affects Version/s: None
Fix Version/s: 3.11.0

Type: Bug Priority: Minor - P4
Reporter: Shane Harvey Assignee: Ross Lawley
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


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



 Comments   
Comment by Githook User [ 01/Aug/19 ]

Author:

{'name': 'Ross Lawley', 'email': 'ross.lawley@gmail.com', 'username': 'rozza'}

Message: Async Client side encryption support

And minor updates to the sync api so both apis mirror each other.

JAVA-3312 JAVA-3359
Branch: mongot
https://github.com/mongodb/mongo-java-driver/commit/653de0e4dbb3a60cf53a24935aa2f20aabab4164

Comment by Githook User [ 25/Jul/19 ]

Author:

{'name': 'Ross Lawley', 'email': 'ross.lawley@gmail.com', 'username': 'rozza'}

Message: Async Client side encryption support

And minor updates to the sync api so both apis mirror each other.

JAVA-3312 JAVA-3359
Branch: master
https://github.com/mongodb/mongo-java-driver/commit/653de0e4dbb3a60cf53a24935aa2f20aabab4164

Comment by Ross Lawley [ 24/Jul/19 ]

Done alongside the async work: PR: https://github.com/rozza/mongo-java-driver/pull/329

Comment by Ross Lawley [ 23/Jul/19 ]

Good spot shane.harvey thanks

Generated at Thu Feb 08 08:59:25 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.