[SERVER-58209] Make NetworkInterfaceIntegrationFixture wait for in progress requests Created: 01/Jul/21  Updated: 29/Oct/23  Resolved: 17/Aug/21

Status: Closed
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: 5.1.0-rc0

Type: Bug Priority: Major - P3
Reporter: Amirsaman Memaripour Assignee: Alex Li
Resolution: Fixed Votes: 1
Labels: carry-over, servicearch-wfbf-day
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to SERVER-58139 Avoid leaking state from NetworkInter... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Service Arch 2021-07-12, Service Arch 2021-08-09, Service Arch 2021-08-23
Participants:
Linked BF Score: 20
Story Points: 2

 Description   

The fixture creates a new instance of NetworkInterface for every test. The network interface is shutdown after every test using tearDown (see here).

void NetworkInterfaceIntegrationFixture::startNet(
    std::unique_ptr<NetworkConnectionHook> connectHook) {
 
    createNet(std::move(connectHook));
    net().startup();
}
 
void NetworkInterfaceIntegrationFixture::tearDown() {
    // Network interface will only shutdown once because of an internal shutdown guard
    _net->shutdown();
}

Integration tests use this network interface to run remote commands by calling into runCommand:

Future<RemoteCommandResponse> NetworkInterfaceIntegrationFixture::runCommand(
    const TaskExecutor::CallbackHandle& cbHandle, RemoteCommandRequest request) {
    RemoteCommandRequestOnAny rcroa{request};
 
    return net().startCommand(cbHandle, rcroa).then([](TaskExecutor::ResponseOnAnyStatus roa) {
        auto res = RemoteCommandResponse(roa);
        if (res.isOK()) {
            LOGV2(4820500,
                  "Got command result: {response}",
                  "Got command result",
                  "response"_attr = res.toString());
        } else {
            LOGV2(4820501, "Command failed: {error}", "Command failed", "error"_attr = res.status);
        }
        return res;
    });
}

The fixture, however, does not track scheduled commands and may return from tearDown before all in progress commands finish. This violates the contract that different tests run in isolation, as a command may start in one test and complete in another.

To address this issue, NetworkInterfaceIntegrationFixture must ensure all in progress commands complete before returning from tearDown. We may use a similar approach to that used by ThreadPoolTaskExecutor to get notified once the execution of a command is complete (see here).



 Comments   
Comment by Vivian Ge (Inactive) [ 06/Oct/21 ]

Updating the fixversion since branching activities occurred yesterday. This ticket will be in rc0 when it’s been triggered. For more active release information, please keep an eye on #server-release. Thank you!

Comment by Githook User [ 16/Aug/21 ]

Author:

{'name': 'Alex Li', 'email': 'alex.li@mongodb.com', 'username': 'alexli12456'}

Message: SERVER-58209 NetworkInterfaceIntegrationFixture waits for in progress requests
Branch: master
https://github.com/mongodb/mongo/commit/0028db3e9c096e2196e66b1181f5e3c33cc435a3

Generated at Thu Feb 08 05:43:54 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.