You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Provide stdout and stderr from utility process and adopt in extension host #155987
bugIssue identified by VS Code Team member as probable bugconfirmedIssue has been confirmed by VS Code Team memberextension-hostExtension host issuesinsiders-releasedPatch has been released in VS Code Insidersplan-itemVS Code - planned item for upcomingsandboxRunning VSCode in a node-free environmentverifiedVerification succeeded
this should enable inspecting the extension host and start profiling
this requires a restart because this method for UtilityProcess extension hosts is not working similarly to this method for regular nodejs extension host
Make the following when running out of sources so that inspector does not get started on startup
diff --git a/src/vs/platform/environment/common/environmentService.ts b/src/vs/platform/environment/common/environmentService.ts
index d90cbc60fef..32ff30de6da 100644
--- a/src/vs/platform/environment/common/environmentService.ts+++ b/src/vs/platform/environment/common/environmentService.ts@@ -270,7 +270,7 @@ export function parsePtyHostPort(args: NativeParsedArgs, isBuild: boolean): IDeb
function parseDebugParams(debugArg: string | undefined, debugBrkArg: string | undefined, defaultBuildPort: number, isBuild: boolean, debugId?: string, environmentString?: string): IExtensionHostDebugParams {
const portStr = debugBrkArg || debugArg;
- const port = Number(portStr) || (!isBuild ? defaultBuildPort : null);+ const port = Number(portStr) || null;
const brk = port ? Boolean(!!debugBrkArg) : false;
let env: Record<string, string> | undefined;
if (environmentString) {
.\scripts\code.sh
Developer: Show running extensions and click profile action
Now see main process console output which will now print
Debugger listening on ws://127.0.0.1:61222/fa9f6ced-bf9b-49a1-ba32-30690c6ccbfc
For help, see: https://nodejs.org/en/docs/inspector
The problem is that we try to obtain the inspector port for the above action from the stdout/stderr of the extension host process in
Since we current don't support stdout and stderr events for the utility process, we end up with empty inspector ports even though the inspector is started leading to failed profile action which ends up triggering the fallback. Maybe a temporary fix would be to read from the main process stdout. I will see if UtilityProcess.stdout, UtilityProcess.stderr can be implemented to make life easier.
I will see if UtilityProcess.stdout, UtilityProcess.stderr can be implemented to make life easier.
👍 . I had a brief look and it seems we listen to output and stderr not only for the purpose of obtaining the inspect port, but also to observe output and print it in general:
changed the title [-]`UtilityExtensionHostProcess.enableInspectPort` does not work[/-][+]Utility process does not support `stdout` and `stderr`[/+]on Aug 12, 2022
changed the title [-]Utility process does not support `stdout` and `stderr`[/-][+]Provide `stdout` and `stderr` from utility process and adopt in extension host[/+]on Sep 1, 2022
bugIssue identified by VS Code Team member as probable bugconfirmedIssue has been confirmed by VS Code Team memberextension-hostExtension host issuesinsiders-releasedPatch has been released in VS Code Insidersplan-itemVS Code - planned item for upcomingsandboxRunning VSCode in a node-free environmentverifiedVerification succeeded
Activity
deepak1556 commentedon Aug 11, 2022
Update:
I was able to confirm that
SIGUSR1signal handlers are installed by Node.js inside the utility process via https://github.com/nodejs/node/blob/main/src/inspector_agent.cc#L92-L138Also,
process._debugProcess()action is indeed invoked via https://github.com/microsoft/vscode/blob/main/src/vs/platform/extensions/electron-main/extensionHostStarter.ts#L371-L392, to confirm.\scripts\code.shDeveloper: Show running extensionsand click profile actionThe problem is that we try to obtain the inspector port for the above action from the
stdout/stderrof the extension host process invscode/src/vs/workbench/services/extensions/electron-sandbox/localProcessExtensionHost.ts
Lines 292 to 295 in ef65ac1
Since we current don't support stdout and stderr events for the utility process, we end up with empty inspector ports even though the inspector is started leading to failed profile action which ends up triggering the fallback. Maybe a temporary fix would be to read from the main process stdout. I will see if
UtilityProcess.stdout,UtilityProcess.stderrcan be implemented to make life easier.bpasero commentedon Aug 12, 2022
👍 . I had a brief look and it seems we listen to output and stderr not only for the purpose of obtaining the inspect port, but also to observe output and print it in general:
vscode/src/vs/workbench/services/extensions/electron-sandbox/localProcessExtensionHost.ts
Lines 271 to 276 in eebdf81
So I think we need this anyway, not just for debugging purposes. I wonder if this could also impact extension developers that want to log messages...
[-]`UtilityExtensionHostProcess.enableInspectPort` does not work[/-][+]Utility process does not support `stdout` and `stderr`[/+][-]Utility process does not support `stdout` and `stderr`[/-][+]Provide `stdout` and `stderr` from utility process and adopt in extension host[/+]