Drain network responses in FileCopyBasedInitialSyncerTest::CallbackIsCalledIfExecutorIsShutdownAfterStartup test

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • 8.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Networking & Observability
    • Fully Compatible
    • ALL
    • Networking & Obs 2024-12-09
    • 200
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      The test does not process network responses after shutting down the task executor, and so it will hang during shutdown waiting for the initialSync future to be fulfilled.

      This can be fixed by adding _mock->runUntilIdle(); after getExecutor().shutdown(); in the test.

      Adding a sleep consistently repros this issue:

      TEST_F(FileCopyBasedInitialSyncerTest, CallbackIsCalledIfExecutorIsShutdownAfterStartup) {
          auto* fileCopyBasedInitialSyncer = getFileCopyBasedInitialSyncer();
          auto opCtx = makeOpCtx();
          ASSERT_FALSE(fileCopyBasedInitialSyncer->isActive());
          ASSERT_OK(fileCopyBasedInitialSyncer->startup(opCtx.get(), maxAttempts));
          ASSERT_TRUE(fileCopyBasedInitialSyncer->isActive());
          sleep(2);
          getExecutor().shutdown();
          ASSERT_OK(fileCopyBasedInitialSyncer->shutdown());
          fileCopyBasedInitialSyncer->join();
          ASSERT_EQUALS(ErrorCodes::ShutdownInProgress, _lastApplied);
      } 

            Assignee:
            Erin McNulty
            Reporter:
            Erin McNulty
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: