Uploaded image for project: 'Drivers'
  1. Drivers
  2. DRIVERS-1861

[FLE] Clarify spawning and connecting to mongocryptd

    • Type: Icon: Spec Change Spec Change
    • Resolution: Unresolved
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Component/s: Client Side Encryption
    • None

      The client side encryption spec is not clear on some points about spawning and connecting to mongocryptd.

      1. What should happen if there is an error spawning mongocryptd? The Java driver currently throws an exception, but the spec does not mandate anything. [if process API has a way to report errors, then it can be reported (e.g. the path to mongocryptd does not exist). However a non-zero exit status because pid file already exists should _not_ raise an exception, because that's normal (e.g. multiple MongoClient on same server]
      2. Should the driver wait after spawning before attempting to connect? [No, we use server selection timeout for that]
      3. Should the driver attempt to read the PID file, and should that PID file be in a known system location? [Possibly, see SPEC-1388]
      4. If the user passes extraOptions.mongocryptdURI should the driver parse the URI for the port to spawn on, pass that port to the mongocryptd being spawned? [No. App would have to also turn off auto spawning to achieve this effect]
      5. Should the spawned mongocryptd child process be detached from the parent? Does the child need to be able to stay running after the parent closes? Does the child need to be kicked off into its own process group / session? [Yes, though not sure what that means at an API level for each language. e.g. Java has no "detach" capability. It just happens]
      6. mongocryptd supports both [--idleShutdownTimeoutSecs=60] and [–idleShutdownTimeoutSecs, 60] as startup arguments. The "Managing mongocryptd" section should be updated to clarify that drivers should check for both formats when determining whether a timeout needs to be appended. [Addressed]
      7. The sentence "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." indicates that we only spawn on first use. This should be amended (perhaps with a sentence before) to indicate we spawn mongocryptd in MongoClient constructor.
      8. There are reports of mongocryptd messages being logged on self-termination which misleadingly indicates an error even though connection succeeds for pymongo. Perhaps we should specify that mongocryptd log messages be hidden, buffered and only shown on error, redirected to a log file by default, etc.

            Assignee:
            Unassigned Unassigned
            Reporter:
            kevin.albertson@mongodb.com Kevin Albertson
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated: