Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-62709

Fix `transport_layer_asio_test` build-failure on `Enterprise Windows C++20 DEBUG`

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 5.3.0
    • Affects Version/s: None
    • Component/s: Internal Code
    • None
    • Fully Compatible
    • ALL
    • v5.0
    • Service Arch 2022-1-24
    • 70
    • 1

      SERVER-62571 introduced a few changes to ThrowOnNetworkErrorInEnsureSync, one of the tests in transport_layer_asio_test.cpp, to fix a data-race in the unit-test. One of the changes was introducing a scope-guard, that will set a barrier upon returning from a lambda (defined here):

      ...
          unittest::Barrier barrier(2);
          ConnectionThread connectThread(tf.tla().listenerPort(), [&](ConnectionThread& conn) {
              ON_BLOCK_EXIT([&] { barrier.countDownAndWait(); }); // This line is causing the build failure.
      
              // Linger timeout = 0 causes a RST packet on close.
              struct linger sl = {1, 0};
              if (setsockopt(conn.socket().rawFD(),
                             SOL_SOCKET,
                             SO_LINGER,
                             reinterpret_cast<SetsockoptPtr>(&sl),
                             sizeof(sl)) != 0) {
                  auto err = make_error_code(std::errc{errno});
                  LOGV2_ERROR(6060300, "setsockopt", "error"_attr = err.message());
              }
          });
      ...
      

      Building transport_layer_asio_test.cpp with "Enterprise Windows C++20 DEBUG" is failing after SERVER-62571 is merged. Removing the scope-guard, however, fixes the build-failure. This ticket should resolve the issue by either fixing the issue with scope-guards and the new Windows build system, or replacing the scope-guard with an alternative.

            Assignee:
            amirsaman.memaripour@mongodb.com Amirsaman Memaripour
            Reporter:
            amirsaman.memaripour@mongodb.com Amirsaman Memaripour
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: