[SERVER-60449] Provide platform-independent method to whack the running process Created: 04/Oct/21  Updated: 06/Dec/22

Status: Backlog
Project: Core Server
Component/s: Internal Code
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Major - P3
Reporter: Sergey Galtsev (Inactive) Assignee: Backlog - Security Team
Resolution: Unresolved Votes: 0
Labels: former-quick-wins
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Assigned Teams:
Server Security
Participants:

 Description   

When we run external daemons such as service mocks, we typically use stopMongoProgramByPid to terminate them. This invocation does not work the same way on all platforms, which leads to the need to use complex shutdown methodologies such as:

 
function killPyKMIPServer(pid) {
    if (_isWindows()) {
        // we use taskkill because we need to kill children
        waitProgram(_startMongoProgram("taskkill", "/F", "/T", "/PID", pid));
        // waitProgram to ignore error code
        waitProgram(pid);
    } else {
        let kSIGINT = 2;
        stopMongoProgramByPid(pid, kSIGINT);
    }
}

This ticket is to research and implement a single function which would reliably terminate the process by PID on every platform, also killing children and gradually stepping up terminate signals on linux (SIGTERM, then SIGINT, then SIGKILL)


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