Slow spawn of mongocryptd

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Unknown
    • 2.18.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      When using automated encryption, it takes about 20 seconds to spawn mongocryptd daemon.
      To reproduce - take example from our docs, and execute without manually starting mongocryptd.

      There will be warnings in logs:

      W, [2022-03-14T10:25:03.090336 #26487]  WARN -- : MONGODB | Error checking localhost:27020: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27020 (for 127.0.0.1:27020 (no TLS)) (on localhost:27020)
      W, [2022-03-14T10:25:04.099528 #26487]  WARN -- : MONGODB | Error checking localhost:27020: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27020 (for 127.0.0.1:27020 (no TLS)) (on localhost:27020)
      ...
      W, [2022-03-14T10:25:24.112462 #26487]  WARN -- : MONGODB | Error checking localhost:27020: Mongo::Error::SocketError: Errno::ECONNREFUSED: Connection refused - connect(2) for 127.0.0.1:27020 (for 127.0.0.1:27020 (no TLS)) (on localhost:27020)
      

      The problem seems to be that the driver first tries to connect to mongocryptd cluster, and detect a primary there. When detection fails, it raises an exception #<Mongo::Error::NoServerAvailable: No primary server is available in cluster: #<Cluster topology=Unknown[localhost:27020] servers=[#<Server address=localhost:27020 UNKNOWN>]> with timeout=10, LT=0.015>, and only after that spawns mongocryptd.

            Assignee:
            Dmitry Rybakov
            Reporter:
            Dmitry Rybakov
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: