Skip to content

Import and Compile has become very slow since VS Code 1.93 #1428

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

Closed
jpa95 opened this issue Sep 11, 2024 · 15 comments · Fixed by #1432
Closed

Import and Compile has become very slow since VS Code 1.93 #1428

jpa95 opened this issue Sep 11, 2024 · 15 comments · Fixed by #1432
Assignees
Labels
bug Something isn't working

Comments

@jpa95
Copy link

jpa95 commented Sep 11, 2024

The process seems to work but it will import 4-5 files, then block for 10+secs, then get 4-5 more, etc. Not usable in out context.

Downgrading to VS Code 1.92.2 solves my problem.

InterSystems ObjectScript v2.12.7
InterSystems Server Manager v3.6.2
InterSystems Language Server v2.6.1

@mathewrimmingtoncds
Copy link

The company I work for are also getting this problem. I did have a look through the source code on this repo and can see some suspect looking code in the request method of index.ts, but I can't explain why it would have worked fine prior to VSCode 1.93.

@GendronAC
Copy link

Reproduced in 1.93.1 too

@isc-rsingh isc-rsingh added the bug Something isn't working label Sep 17, 2024
@gjsjohnmurray
Copy link
Contributor

some suspect looking code in the request method of index.ts

@mathewrimmingtoncds Are you able to be more specific?

@mathewrimmingtoncds
Copy link

mathewrimmingtoncds commented Sep 18, 2024

some suspect looking code in the request method of index.ts

@mathewrimmingtoncds Are you able to be more specific?

Take a look at this: https://github.com/intersystems-community/vscode-objectscript/blob/a53daf7bad0b6aeb1fbfc747dbc893e9dcf5a9b9/src/api/index.ts#L306C1-L310C8
It appears to be creating a new keep alive connection for every single request! Full disclosure here: I don't know how to debug VSCode extensions so haven't proved this is the cause. It just looks bad.

I logged a WRC ticket too, the saliant bit of the response from them was:

I looked into this and I think the problem is that VSCode does not reuse the already-established HTTP connections for new requests. Just about any action in VSCode (including compiling or import-and-compile) will result in API calls to the backend. We set the keepAlive flag to true with the intention of saving the connections in a pool. In 1.93 we apparently never pull connections out of the pool, and so the number of ESTABLISHED connections in netstat keeps rising.

Unfortunately WRC have denied being able to help to repair this. It's a shame that IRIS will soon have no editor and the one nice way of editing source code isn't working very well and is not supported by them.

@gjsjohnmurray
Copy link
Contributor

If you have a reliable repro for this issue and are willing to try an updated VSIX please download the zipfile at https://github.com/intersystems-community/vscode-objectscript/actions/runs/10928954754/artifacts/1949752034 and extract the VSIX it contains. Install that (drag/drop onto the Extensions view is one way), restart VS Code, then try your repro again.

@jpa95
Copy link
Author

jpa95 commented Sep 18, 2024

Hi John,

on v2.12.8-dev.1432 with VS Code 1.93.1:
Import and Compile of a folder with a small number of files (less than 10), it works well, speed seems as good as before.

On larger number of files, the first 30-50 imports go fast, then the process slows down to a crawl. Files are still being imported but at seemingly random points the process stops writing the import message, nothing happens for many seconds (random amount of time, sometimes 1+ min).

When it finished importing my 168 files (took 5 minutes), it started compiling and took about 2-3 minutes to report that "Compilation finished successfully in 0.159s."

Went back to VS Code 1.92.2 and it works.

@gjsjohnmurray
Copy link
Contributor

gjsjohnmurray commented Sep 18, 2024

@jpa95 please try running this command from outside VS Code (prerequisite is a local install of Node.js):

npx --yes @vscode/vscode-bisect@latest --releasedOnly --bad 4849ca9bdf9666755eb463db297b69e5385090e3 --good b1c0a14de1414fcdaa400695b4db1c0799bc3124

It will download a 1.93.0-insider build and launch it. Use it to run your repro. This first build should be about half way between the start of 1.93 (i.e. just after 1.92 Stable shipped) and the end of it (when 1.93 Stable shipped). The command session you launched the bisect command wants you to answer "Good" or "Bad", at which point it will close the VS Code it launched and download either an earlier one (if you said "Bad") or a later one (if "Good").

I hope this procedure may eventually point to the first 1.93.0-insider build that has the problem. Builds usually happen once per weekday, so success here ought to narrow down the set of commits for me to seek clues in.

@gjsjohnmurray
Copy link
Contributor

Unfortunately WRC have denied being able to help to repair this. It's a shame that IRIS will soon have no editor and the one nice way of editing source code isn't working very well and is not supported by them.

@mathewrimmingtoncds this has been miscommunicated. WRC have referred the issue to the extension devs (I am one of them) and we are working to resolve it.

If you are in a position to follow the VS Code bisect procedure I described above this may help us pinpoint what changed in 1.93 to cause it.

@gjsjohnmurray
Copy link
Contributor

New VSIX for testing is in https://github.com/intersystems-community/vscode-objectscript/suites/28622933729/artifacts/1956331615

This one no longer setskeepAlive: true on its http[s].Agent, which had long been done by us but which until 1.93 was apparently not forwarded to Node.js by the proxy agent.

🤞

@jpa95
Copy link
Author

jpa95 commented Sep 20, 2024

Houston, we don't have a problem!

Looks very good @gjsjohnmurray, thanks! Tested with VS Code 1.93.1. Imported two separate filesets that have 1k+ files in them (in one go each), as usual.

I'll keep using it in my everyday tasks and get back here if I see a problem.

@jpa95
Copy link
Author

jpa95 commented Sep 20, 2024

Oh and apologies I did not see your npx --yes answer yesterday.

gjsjohnmurray added a commit that referenced this issue Sep 20, 2024
* Bump node-fetch-cjs to investigate 1.93 performance issue

* Reuse Agent across requests

* Don't enable keepAlive, in case this is causing #1428

* Add comments now the workaround has been validated
@gjsjohnmurray
Copy link
Contributor

Anyone experiencing this problem should download https://github.com/intersystems-community/vscode-objectscript/releases/download/v2.12.8-beta.3/vscode-objectscript-2.12.8-beta.3.vsix and verify (hopefully) that the slowdowns no longer occur on VS Code 1.93+

If it passes your testing please add a comment here. Unless there are any adverse reports we plan to publish v2.12.8 on Marketplace early next week.

@jpa95
Copy link
Author

jpa95 commented Sep 20, 2024

@gjsjohnmurray beta 3 looking good.

@mathewrimmingtoncds
Copy link

@gjsjohnmurray, this release works for me too, thanks. I can import a few hundred routines quickly and I'm not left with any established connections when running netstat.

@gjsjohnmurray
Copy link
Contributor

Thanks all. Please update to v2.12.8 from Marketplace, or if you want to use proposed APIs get v2.12.9-beta.1 and install it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants