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

Drain network responses in FileCopyBasedInitialSyncerTest::CallbackIsCalledIfExecutorIsShutdownAfterStartup test

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 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

      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@mongodb.com Erin McNulty
            Reporter:
            erin.mcnulty@mongodb.com Erin McNulty
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: