From 302202b4fb617f7a3129ae82a71fce8cbf8488ff Mon Sep 17 00:00:00 2001 From: Paul Fitzpatrick Date: Wed, 10 Nov 2021 09:59:48 -0500 Subject: [PATCH] (core) freshen tests for python3 Summary: Recent python3 changes perturbed timing again, and a few more tests started failing. Contains an unrelated correction for gvisor running under docker (a useful configuration on macs for debugging gvisor problems, but not supported by throttling code). Test Plan: updated tests Reviewers: dsagal, alexmojaki Reviewed By: dsagal, alexmojaki Differential Revision: https://phab.getgrist.com/D3129 --- app/server/lib/SandboxControl.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/app/server/lib/SandboxControl.ts b/app/server/lib/SandboxControl.ts index 06bee705..43ac43f8 100644 --- a/app/server/lib/SandboxControl.ts +++ b/app/server/lib/SandboxControl.ts @@ -104,6 +104,7 @@ export class SubprocessControl implements ISandboxControl { private _throttle?: Throttle; private _monitoredProcess: Promise; private _active: boolean; + private _foundDocker: boolean = false; constructor(private _options: { pid: number, // pid of process opened by Grist @@ -134,6 +135,10 @@ export class SubprocessControl implements ISandboxControl { } public async kill() { + if (this._foundDocker) { + process.kill(this._options.pid, 'SIGKILL'); + return; + } for (const proc of await this._getAllProcesses()) { try { process.kill(proc.pid, 'SIGKILL'); @@ -179,7 +184,10 @@ export class SubprocessControl implements ISandboxControl { const recognizer = this._options.recognizers[key]; if (!recognizer) { continue; } for (const proc of processes) { - if (proc.label.includes('docker')) { throw new Error('docker barrier found'); } + if (proc.label.includes('docker')) { + this._foundDocker = true; + throw new Error('docker barrier found'); + } if (recognizer(proc)) { recognizedProcesses[key] = proc; continue;