From 69911876969f64d80305aa9968bf9d8ea2b4c08c Mon Sep 17 00:00:00 2001 From: Asher Date: Fri, 26 Aug 2022 14:20:04 -0500 Subject: [PATCH 1/3] Use fork instead of spawn We no longer do in-place updating so no need for the spawn. The advantage of a fork is that it preserves flags like --prof which you can use to profile code-server. Also I am not sure that comment was even true to begin with. --- src/node/wrapper.ts | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/node/wrapper.ts b/src/node/wrapper.ts index cf64f5741090..dde6034628d5 100644 --- a/src/node/wrapper.ts +++ b/src/node/wrapper.ts @@ -317,8 +317,7 @@ export class ParentProcess extends Process { } private spawn(): cp.ChildProcess { - // Use spawn (instead of fork) to use the new binary in case it was updated. - return cp.spawn(process.argv[0], process.argv.slice(1), { + return cp.fork(path.join(__dirname, "entry"), { env: { ...process.env, CODE_SERVER_PARENT_PID: process.pid.toString(), From b11e19f7fa3ff511fa682ebe1f8757c1ab0ba955 Mon Sep 17 00:00:00 2001 From: Asher Date: Fri, 26 Aug 2022 14:58:12 -0500 Subject: [PATCH 2/3] Refresh heartbeat patch Seems to have gotten out of date a little. --- patches/heartbeat.diff | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/patches/heartbeat.diff b/patches/heartbeat.diff index 3208b6c3c35f..4a7125a7bdc6 100644 --- a/patches/heartbeat.diff +++ b/patches/heartbeat.diff @@ -15,7 +15,7 @@ Index: code-server/lib/vscode/src/vs/base/parts/ipc/common/ipc.net.ts export const enum SocketDiagnosticsEventType { Created = 'created', -@@ -828,6 +829,19 @@ export class PersistentProtocol implemen +@@ -829,6 +830,19 @@ export class PersistentProtocol implemen this._socketDisposables.push(this._socketWriter); this._socketReader = new ProtocolReader(this._socket); this._socketDisposables.push(this._socketReader); From e74998f4b09cea9a50e47e0f0c1945145824333d Mon Sep 17 00:00:00 2001 From: Asher Date: Fri, 26 Aug 2022 15:58:37 -0500 Subject: [PATCH 3/3] Propagate execArgv to extension host This will let us profile the extension host. --- patches/exec-argv.diff | 17 +++++++++++++++++ patches/series | 1 + 2 files changed, 18 insertions(+) create mode 100644 patches/exec-argv.diff diff --git a/patches/exec-argv.diff b/patches/exec-argv.diff new file mode 100644 index 000000000000..d16a446b4500 --- /dev/null +++ b/patches/exec-argv.diff @@ -0,0 +1,17 @@ +Preserve process.execArgv + +This ensures flags like --prof are passed down so we can profile everything. + +Index: code-server/lib/vscode/src/vs/server/node/extensionHostConnection.ts +=================================================================== +--- code-server.orig/lib/vscode/src/vs/server/node/extensionHostConnection.ts ++++ code-server/lib/vscode/src/vs/server/node/extensionHostConnection.ts +@@ -228,7 +228,7 @@ export class ExtensionHostConnection { + + public async start(startParams: IRemoteExtensionHostStartParams): Promise { + try { +- let execArgv: string[] = []; ++ let execArgv: string[] = process.execArgv ? process.execArgv.filter(a => !/^--inspect(-brk)?=/.test(a)) : []; + if (startParams.port && !(process).pkg) { + execArgv = [`--inspect${startParams.break ? '-brk' : ''}=${startParams.port}`]; + } diff --git a/patches/series b/patches/series index 8b7cc28ea6fa..40ebf2706e2a 100644 --- a/patches/series +++ b/patches/series @@ -21,3 +21,4 @@ telemetry.diff display-language.diff cli-window-open.diff heartbeat.diff +exec-argv.diff