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

fsautocomplete is not killed when extension is closed #1703

Closed
LiteracyFanatic opened this issue May 5, 2022 · 4 comments
Closed

fsautocomplete is not killed when extension is closed #1703

LiteracyFanatic opened this issue May 5, 2022 · 4 comments

Comments

@LiteracyFanatic
Copy link

Describe the bug

Closing and relaunching VS Code or executing the Reload Window command creates a new fsautocomplete process but does not kill existing ones. Over time, many processes are created and consume lots of memory.

Steps to reproduce

Just close and reopen VS Code a few times or use the Reload Window command. Observe the instances of fsautocomplete in a process viewer.

Expected behavior

All processes spawned by the extension close with it. Only one instance of fsautocomplete is present at a time.

Machine info

  • Operating system: Linux
  • Arch: x64
  • VSCode: 1.66.2
  • UI Kind: Desktop
  • Ionide: 6.0.2
  • Runtime: netcore
  • Dotnet version: 6.0.102

Additional context

I captured logs of the active fsautocomplete processes using a small shell script, watch-ionide. Observing the changes in PIDs from several runs, I noticed that when restarting VS Code completely has a tendency to eventually stabilize to a fixed number of running processes while reloading will keep increasing the number of processes without bound.

#!/bin/bash
oldOutput=""
while true; do
    output="$(pgrep -af ionide | grep -v watch-ionide)"
    if [[ "$output" != "$oldOutput" ]]; then
        echo "$output"
        echo '-------'
        oldOutput="$output"
    fi
    sleep 0.1
done

reload.log
restart.log

Here are the logs from the extension window for the same two trials.

extension-reload.log
extension-restart.log

Not sure if it matters, but I'll mention that I launch VS code with --extensions-dir="$XDG_DATA_HOME/vscode/extensions".

@vain0x
Copy link
Contributor

vain0x commented May 21, 2022

This could be related to an issue of vscode-languageclient v7.x: microsoft/vscode-languageserver-node#726 (comment) which is used by ionide-vscode-fsharp . The issue is fixed since vscode-languageclient v8.

Note I tried updating to [email protected] but build failed...

ERROR in ./node_modules/vscode-languageclient/lib/node/main.js 267:50
Module parse failed: Unexpected token (267:50)

                    const options = node.options ?? Object.create(null);
Full of logs ``` Starting target 'RunScript' /repo/vendor/ionide-vscode-fsharp> "dotnet" fable ./src/Ionide.FSharp.fsproj -s --outDir ./out --run webpack --mode=production (In: false, Out: false, Err: false) Fable: F# to JS compiler 3.7.8 Stop Russian aggression against Ukraine!

Parsing src/Ionide.FSharp.fsproj...
src> dotnet restore Ionide.FSharp.fsproj
復元対象のプロジェクトを決定しています...
復元対象のすべてのプロジェクトは最新です。
Project and references (45 source files) parsed in 2584ms

Started Fable compilation...
Fable compilation finished in 7428ms

./paket-files/ionide/ionide-vscode-helpers/src/Helpers.fs(86,24): (86,42) warning FSHARP: This construct is deprecated. Use { (code 44)
./paket-files/ionide/ionide-vscode-helpers/src/Helpers.fs(147,24): (147,42) warning FSHARP: This construct is deprecated. Use { (code 44)
./paket-files/ionide/ionide-vscode-helpers/src/Helpers.fs(203,24): (203,42) warning FSHARP: This construct is deprecated. Use { (code 44)
./src/Core/Environment.fs(16,17): (16,24) warning FSHARP: The identifier 'process' is reserved for future use by F# (code 46)
./src/Core/LanguageService.fs(758,62): (758,69) warning FSHARP: The identifier 'process' is reserved for future use by F# (code 46)
./src/Core/LanguageService.fs(763,58): (763,65) warning FSHARP: The identifier 'process' is reserved for future use by F# (code 46)
./src/Core/Project.fs(138,48): (138,66) warning FSHARP: This construct is deprecated. Use { (code 44)
./src/Core/Project.fs(138,58): (138,66) warning FSHARP: This construct is deprecated. Use { (code 44)
./src/Core/Project.fs(168,15): (168,33) warning FSHARP: This construct is deprecated. Use { (code 44)
./src/Core/Project.fs(195,15): (195,33) warning FSHARP: This construct is deprecated. Use { (code 44)
./src/Core/Project.fs(314,15): (314,33) warning FSHARP: This construct is deprecated. Use { (code 44)
./src/Core/Project.fs(346,42): (346,60) warning FSHARP: This construct is deprecated. Use { (code 44)
./src/Core/Project.fs(346,52): (346,60) warning FSHARP: This construct is deprecated. Use { (code 44)
./src/Core/Project.fs(413,46): (413,64) warning FSHARP: This construct is deprecated. Use { (code 44)
./src/Core/Project.fs(413,56): (413,64) warning FSHARP: This construct is deprecated. Use { (code 44)
./src/Core/Project.fs(476,47): (476,65) warning FSHARP: This construct is deprecated. Use { (code 44)
./src/Core/Project.fs(476,57): (476,65) warning FSHARP: This construct is deprecated. Use { (code 44)
./src/Core/Project.fs(575,59): (575,77) warning FSHARP: This construct is deprecated. Use { (code 44)
./src/Core/Project.fs(575,69): (575,77) warning FSHARP: This construct is deprecated. Use { (code 44)
./src/Core/Project.fs(583,23): (583,41) warning FSHARP: This construct is deprecated. Use { (code 44)
./src/Core/Project.fs(586,57): (586,75) warning FSHARP: This construct is deprecated. Use { (code 44)
./src/Core/Project.fs(586,67): (586,75) warning FSHARP: This construct is deprecated. Use { (code 44)
./src/Components/Diagnostics.fs(115,40): (115,58) warning FSHARP: This construct is deprecated. Use { (code 44)
./src/Components/Diagnostics.fs(115,50): (115,58) warning FSHARP: This construct is deprecated. Use { (code 44)
./src/Components/Fsi.fs(268,27): (268,45) warning FSHARP: This construct is deprecated. Use { (code 44)
./src/Components/Fsi.fs(268,37): (268,45) warning FSHARP: This construct is deprecated. Use { (code 44)
./src/Components/Fsi.fs(575,44): (575,62) warning FSHARP: This construct is deprecated. Use { (code 44)
./src/Components/Fsi.fs(575,54): (575,62) warning FSHARP: This construct is deprecated. Use { (code 44)
./src/Components/Fsi.fs(615,40): (615,58) warning FSHARP: This construct is deprecated. Use { (code 44)
./src/Components/Fsi.fs(615,50): (615,58) warning FSHARP: This construct is deprecated. Use { (code 44)
./src/Components/Debugger.fs(81,27): (81,45) warning FSHARP: This construct is deprecated. Use { (code 44)
./src/Components/Debugger.fs(81,37): (81,45) warning FSHARP: This construct is deprecated. Use { (code 44)
./src/Components/SolutionExplorer.fs(673,23): (673,41) warning FSHARP: This construct is deprecated. Use { (code 44)
./src/Components/SolutionExplorer.fs(717,55): (717,73) warning FSHARP: This construct is deprecated. Use { (code 44)
./src/Components/SolutionExplorer.fs(717,65): (717,73) warning FSHARP: This construct is deprecated. Use { (code 44)
./src/Components/SolutionExplorer.fs(720,55): (720,73) warning FSHARP: This construct is deprecated. Use { (code 44)
./src/Components/SolutionExplorer.fs(720,65): (720,73) warning FSHARP: This construct is deprecated. Use { (code 44)
./src/Components/TestExplorer.fs(203,23): (203,30) warning FSHARP: The identifier 'include' is reserved for future use by F# (code 46)
./src/Components/TestExplorer.fs(235,48): (235,55) warning FSHARP: The identifier 'include' is reserved for future use by F# (code 46)
./src/Components/Fsi.fs(385,22): (385,60) warning FABLE: Cannot type test (evals to false): interfaces
./src/Components/Fsi.fs(400,22): (400,37) warning FABLE: Cannot type test (evals to false): interfaces
./src/Components/SolutionExplorer.fs(469,30): (469,38) warning FABLE: Cannot type test (evals to false): interfaces
.> node_modules/.bin/webpack --mode=production
Bundling for production...
Output path: release
Hash: 8e852c4697305d74da5f
Version: webpack 4.44.1
Time: 15980ms
Built at: 2022/05/21 15:24:32
2 assets
Entrypoint main = fsharp.js fsharp.js.map
[0] ./out/fable_modules/fable-library.3.7.8/Reflection.js 17.6 KiB {0} [built]
[1] ./out/fable_modules/fable-library.3.7.8/Seq.js 39.9 KiB {0} [built]
[2] ./out/fable_modules/fable-library.3.7.8/Util.js 17.3 KiB {0} [built]
[3] ./out/fable_modules/fable-library.3.7.8/List.js 37.2 KiB {0} [built]
[4] ./out/fable_modules/fable-library.3.7.8/Option.js 2.77 KiB {0} [built]
[5] external "vscode" 42 bytes {0} [built]
[6] ./out/Core/Utils.js 11.2 KiB {0} [built]
[7] ./out/fable_modules/fable-library.3.7.8/String.js 21.4 KiB {0} [built]
[8] ./out/fable_modules/Fable.Promise.3.1.3/PromiseImpl.fs.js 100 bytes {0} [built]
[9] ./out/fable_modules/fable-library.3.7.8/Types.js 10.4 KiB {0} [built]
[10] ./out/fable_modules/fable-library.3.7.8/Long.js + 1 modules 44.7 KiB {0} [built]
| ./out/fable_modules/fable-library.3.7.8/Long.js 5.06 KiB [built]
| ./out/fable_modules/fable-library.3.7.8/lib/long.js 39.6 KiB [built]
[11] ./out/fable_modules/fable-library.3.7.8/Choice.js 9.03 KiB {0} [built]
[13] ./out/fable_modules/Fable.Promise.3.1.3/Promise.fs.js 3.45 KiB {0} [built]
[15] ./out/fable_modules/fable-library.3.7.8/Array.js 31.8 KiB {0} [built]
[151] ./out/fsharp.js + 46 modules 819 KiB {0} [built]
| ./out/fsharp.js 10.5 KiB [built]
| ./out/Core/DTO.js 69.1 KiB [built]
| ./out/Core/LanguageService.js 51.7 KiB [built]
| ./out/Core/Project.js 35.4 KiB [built]
| ./out/Components/QuickInfoProject.js 3.92 KiB [built]
| ./out/Components/MSBuild.js 23.1 KiB [built]
| ./out/Core/FsProjEdit.js 4.08 KiB [built]
| ./out/Components/Debugger.js 18.9 KiB [built]
| ./out/Components/Fsi.js 26.7 KiB [built]
| ./out/Components/SolutionExplorer.js 64 KiB [built]
| ./out/Components/Diagnostics.js 5.37 KiB [built]
| ./out/Components/LineLens.js 22.4 KiB [built]
| ./out/Components/QuickInfo.js 7.9 KiB [built]
| ./out/Components/Help.js 1.57 KiB [built]
| ./out/Components/SignatureData.js 1.33 KiB [built]
| + 32 hidden modules
+ 137 hidden modules

ERROR in ./node_modules/vscode-languageclient/lib/node/main.js 267:50
Module parse failed: Unexpected token (267:50)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
| if (node.runtime) {
| const args = [];

                const options = node.options ?? Object.create(null);

| if (options.execArgv) {
| options.execArgv.forEach(element => args.push(element));
@ ./out/Core/LanguageService.js 31:0-55 1006:15-29
@ ./out/fsharp.js
Compilation failed
Finished (Failed) 'RunScript' in 00:00:28.5716943


Build Time Report

Target Duration


Clean 00:00:00.0094844
DotNetRestore 00:00:01.7238092
YarnInstall 00:00:00.4557398
Format 00:00:00.0932095
RunScript 00:00:28.5714470 (Error while running 'dotnet fable' with args: ./src/Ionide.FSharp.fsproj -s --outDir ./out --run webpack --mode=production )
Default 00:00:00 (skipped)
Total: 00:00:30.9774386
Status: Failure

Unhandled exception. Fake.Core.BuildFailedException: Target 'RunScript' failed.
---> System.AggregateException: One or more errors occurred. (Error while running 'dotnet fable' with args: ./src/Ionide.FSharp.fsproj -s --outDir ./out --run webpack --mode=production )
---> System.Exception: Error while running 'dotnet fable' with args: ./src/Ionide.FSharp.fsproj -s --outDir ./out --run webpack --mode=production
at Microsoft.FSharp.Core.PrintfModule.PrintFormatToStringThenFail@1439.Invoke(String message) in D:\a_work\1\s\src\fsharp\FSharp.Core\printf.fs:line 1439
at Program.Fable.run(Args args) in /home/owner/repo/vendor/ionide-vscode-fsharp/build/Program.fs:line 165
at [email protected](TargetParameter _arg7) in /home/owner/repo/vendor/ionide-vscode-fsharp/build/Program.fs:line 313
at Fake.Core.TargetModule.runSimpleInternal(TargetContext context, Target target)
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
at Fake.Core.TargetModule.raiseIfError(OptionalTargetContext context)
at Fake.Core.TargetModule.runOrDefaultWithArguments(String defaultTarget)
at Program.main(String[] argv) in /home/owner/repo/vendor/ionide-vscode-fsharp/build/Program.fs:line 447


- .NET 6, Ubuntu 20.04
</details>

@baronfel
Copy link
Contributor

I think it is realted to that issue @vain0x. The FSAC LSP implementation recently took a fix around this that we haven't released yet, but I agree that updateing to the v8 version of the language client will be the correct fix. That'll be a multi-step operation, though, as the F# bindings need to be updated first.

@baronfel
Copy link
Contributor

This will be fixed by #1713

@LiteracyFanatic
Copy link
Author

I am no longer experiencing this issue with Ionide v6.0.5.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants