Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-4207

mongoc_topology_scanner_node_t.last_failed ignores errors outside of monitoring for singled-threaded SDAM

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 1.20.1
    • Affects Version/s: None
    • Component/s: SDAM
    • Labels:

      Quoting my comment in CLOUDP-104364:

      Using my original test case, I can confirm that libmongoc (used by PHP) is not constructing a handshake command after the fail point triggers and the connection is dropped. The relevant logic is in _begin_hello_cmd, where libmongoc only decides to recreate a handshake hello command if the node has not been used before or has experienced an error. The error-tracking is what's being missed here, and it looks like that is only set in _async_error_or_timeout, which is one of the monitoring callbacks.

      This seems more like a bug in libmongoc, and is perhaps unique to their single-threaded SDAM implementation where monitoring and application sockets are one and the same. In this case, it looks like an error during application usage is not being properly recorded for the monitoring structure. We only discovered this because it causes the absence of a serviceId in the serverless hello response, but more generally this also means that libmongoc is not constructing a handshake when recreating the single monitoring/application socket for singled-threaded applications.

            kevin.albertson@mongodb.com Kevin Albertson
            jmikola@mongodb.com Jeremy Mikola
            0 Vote for this issue
            2 Start watching this issue