Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show Running Extension > Start Extension Host Profile button does nothing #194678

Closed
bmalehorn opened this issue Oct 3, 2023 · 12 comments · Fixed by jrieken/v8-inspect-profiler#3 or #209142
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug extension-host Extension host issues under-discussion Issue is under discussion for relevance, priority, approach

Comments

@bmalehorn
Copy link
Contributor

bmalehorn commented Oct 3, 2023

Does this issue occur when all extensions are disabled?: Yes

  • VS Code Version: 1.83.0-insider (Universal)
  • OS Version: Mac 13.4.1 (22F82)

Steps to Reproduce:

  1. Type Cmd-Shift-P Developer: Show Running Extension
  2. Near the top right there's a circle icon. Hovering over it shows the tooltip "Start Extension Host Profile". Click this button.

Expected:
It starts an extension host profile, turning the icon into a square. Clicking the icon again shows an extension profile, showing which extensions too the most time.

Actual:
Clicking the button does nothing.

Screen Recording 2023-10-03 at 10 27 21 AM

@VSCodeTriageBot
Copy link
Collaborator

Thanks for creating this issue! It looks like you may be using an old version of VS Code, the latest stable release is 1.82.3. Please try upgrading to the latest version and checking whether this issue remains.

Happy Coding!

@bmalehorn
Copy link
Contributor Author

Thanks for creating this issue! It looks like you may be using an old version of VS Code, the latest stable release is 1.82.3. Please try upgrading to the latest version and checking whether this issue remains.

Happy Coding!

Ok, I reproduced this with the latest insiders build & updated the PR description with my insiders version.

@jrieken
Copy link
Member

jrieken commented Oct 5, 2023

This sends the SIGUSR1 signal which on windows doesn't exist. We have or used to have an alternative for that the utility process might not support that?

@deepak1556
Copy link
Contributor

I am unable to repro with latest insiders, can you try the following steps to narrow down the issue

  • Copy the pid of extensionHost from the process explorer
  • In system terminal, run kill -s SIGUSR1 <pid-of-extension-host>
  • In system terminal, run lsof -Pan -p <pid-of-extension-host> -i.
  • Paste the output to this issue thread

@deepak1556 deepak1556 added the info-needed Issue requires more information from poster label Oct 5, 2023
@bmalehorn
Copy link
Contributor Author

bmalehorn commented Oct 9, 2023

Sure.

Copied the pid of Code - Insiders Helper (Plugin):
image

Ran the above commands:

~ 
➜ kill -s SIGUSR1 80532

~ 
➜ lsof -Pan -p 80532 -i
COMMAND     PID          USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
Code\x20- 80532 brianmalehorn   43u  IPv4 0x50cd223cc3432315      0t0  TCP 127.0.0.1:57279 (LISTEN)

@deepak1556
Copy link
Contributor

Great, the output indicates the process has the inspector agent started on 127.0.0.1:57279. This confirms that utility process is able to start the inspector. Now as a next step, can you help us confirm if a client is able to connect to this agent,

  • Restart VSCode
  • Copy the pid of extensionHost from the VSCode process explorer
  • In system terminal, run kill -s SIGUSR1 <pid-of-extension-host>
  • In system terminal, run lsof -Pan -p <pid-of-extension-host> -i.
  • Copy the host:port from the previous output
  • Open chrome or edge browser and visit chrome://inspect page
  • Click Open Dedicated developer tools for Node
  • In the Connection tab enter the host:port that was copied
  • The developer tools should now connect to this process and in the chrome://inspect/#devices page you should see an entry electron/js2c/utility_init under the Remote Devices section

@bmalehorn
Copy link
Contributor Author

Great, the output indicates the process has the inspector agent started on 127.0.0.1:57279. This confirms that utility process is able to start the inspector. Now as a next step, can you help us confirm if a client is able to connect to this agent,

  • Restart VSCode
  • Copy the pid of extensionHost from the VSCode process explorer
  • In system terminal, run kill -s SIGUSR1 <pid-of-extension-host>
  • In system terminal, run lsof -Pan -p <pid-of-extension-host> -i.
~ 
➜ kill -s SIGUSR1 56009                  

~ 
➜ lsof -Pan -p 56009 -i                   
COMMAND     PID          USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
Code\x20- 56009 brianmalehorn   43u  IPv4 0x50cd223cbea06e25      0t0  TCP 127.0.0.1:56567 (LISTEN)
  • Copy the host:port from the previous output
  • Open chrome or edge browser and visit chrome://inspect page
  • Click Open Dedicated developer tools for Node
  • In the Connection tab enter the host:port that was copied
  • The developer tools should now connect to this process and in the chrome://inspect/#devices page you should see an entry electron/js2c/utility_init under the Remote Devices section

image
image
image

Thanks for the instructions. Looks like everything connected OK. I can even use the devtools to capture a performance profile, which can be used as a workaround to find slow extensions.
image

@deepak1556
Copy link
Contributor

Thanks for confirming, @jrieken looks like the inspector agent is working fine for the user, so indicates an issue in the inspector client code path. For this action, the client we use is the profilingservice based on v8-inspect-profler

this._extensionHostProfileService.startProfiling();
, might be worth checking if there is a failure in this path.

@deepak1556 deepak1556 added under-discussion Issue is under discussion for relevance, priority, approach and removed info-needed Issue requires more information from poster labels Oct 17, 2023
@connor4312 connor4312 self-assigned this Nov 20, 2023
@jrieken jrieken added the extension-host Extension host issues label Nov 29, 2023
@connor4312 connor4312 added the bug Issue identified by VS Code Team member as probable bug label Dec 4, 2023
@connor4312
Copy link
Member

connor4312 commented Dec 7, 2023

At least for me this seems to be because the profiler interface is trying to connect to ::1 where the devtools port is only listening on 127.0.0.1. Probably some extra information needs to be passed in this call: https://github.com/jrieken/v8-inspect-profiler/blob/master/index.js#L39

The profile module also eats the underyling error which makes it a little harder to troubleshoot https://github.com/jrieken/v8-inspect-profiler/blob/master/index.js#L47-L52

@connor4312 connor4312 removed their assignment Dec 7, 2023
@deepak1556 deepak1556 removed their assignment Dec 8, 2023
connor4312 added a commit that referenced this issue Mar 29, 2024
Fixes #194678. Requires jrieken/v8-inspect-profiler#3 to be merged and published in order to pass the 'host' down.
@connor4312 connor4312 reopened this Mar 29, 2024
connor4312 added a commit that referenced this issue Apr 2, 2024
* exthost: fix profiling not working

Fixes #194678. Requires jrieken/v8-inspect-profiler#3 to be merged and published in order to pass the 'host' down.

* bump package
@chouzz
Copy link
Contributor

chouzz commented Jun 3, 2024

@deepak1556 @connor4312 Hi, just a question, the extension host profile command works well for me, but how should I analyze extension host performance in vscode.dev or code-server? Seems vscode.dev didn't have this command, and Chrome developer tools could record performance, but it records all the information, and not include extension host related information.

@connor4312
Copy link
Member

Chrome devtools records performance, you need to look in the area for the web worker extension host.

@chouzz
Copy link
Contributor

chouzz commented Jun 3, 2024

Chrome devtools records performance, you need to look in the area for the web worker extension host.

Got it! Thanks!

@microsoft microsoft locked and limited conversation to collaborators Jun 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug extension-host Extension host issues under-discussion Issue is under discussion for relevance, priority, approach
Projects
None yet
7 participants