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
Tests (in test/FsAutoComplete.Tests.Lsp) can be run with dotnet test (that's what build.fsx is using) and dotnet run.
For local testing/debugging I use the later option.
Now the issue: (only dotnet run NOT dotnet test)
For certain tests the tests start itself again with --version as option (-> FsAutoComplete.Tests.Lsp.exe --version on windows) -- which again starts itself again with --version which again starts itself etc. -> The tests are continuously started again as child and clog the system:
When the first root test run finished (or is killed), the remaining FsAutoComplete.Tests.Lsp still remain active (all with --version) (and the newest child again produces a new child which produces a new child etc.).
After a while these processes use all available processing power... (-> kill processes in time with Get-Process "FsAutoComplete.Tests.Lsp" | Stop-Process or killall FsAutoComplete.Tests.Lsp)
This happens on Windows (screenshot above), as well as on Linux (and wsl2):
Reproduction & Log
I'm not quite sure when exactly this occurs, but dotnet run -- --filter "lsp.Ionide WorkspaceLoader.Autocomplete Tests" seems to trigger it
(exact test with error is lsp.Ionide WorkspaceLoader.Autocomplete Tests.Autocomplete within script files.Get Autocomplete module members, but just running this one test alone doesn't trigger the error)
One interesting thing in the logs:
[... ERR] [Opts] Resolved [...] with [{"Range": {"End": {"Column": 10, "Line": 1, "$type": "<>f__AnonymousType6853210082"}, "FileName": "e:/prog/fsharp/FsAutoComplete/test/FsAutoComplete.Tests.Lsp/TestCases/AutocompleteScriptTest/Script.fsx", "Start": {"Column": 0, "Line": 1, "$type": "<>f__AnonymousType6853210082"}, "$type": "<>f__AnonymousType8267187863"}, "Severity": {"$type": "Warning"}, "Message": "The .NET SDK for this script could not be determined. If the script is in a directory using a 'global.json' then ensure the relevant .NET SDK is installed. The output from 'E:\\prog\\fsharp\\FsAutoComplete\\test\\FsAutoComplete.Tests.Lsp\\bin\\Debug\\net5.0\\FsAutoComplete.Tests.Lsp.exe --version' in the directory 'e:\\prog\\fsharp\\FsAutoComplete\\test\\FsAutoComplete.Tests.Lsp\\TestCases\\AutocompleteScriptTest' was: 'Timeout executing command 'E:\\prog\\fsharp\\FsAutoComplete\\test\\FsAutoComplete.Tests.Lsp\\bin\\Debug\\net5.0\\FsAutoComplete.Tests.Lsp.exe' '--version'' and the exit code was '1'.", "Subcategory": "parse", "ErrorNumber": 3384, "Start": {"Column": 0, "Line": 1, "$type": "<>f__AnonymousType6853210082"}, "End": {"Column": 10, "Line": 1, "$type": "<>f__AnonymousType685321008`2"}, "StartLineAlternate": 1, "EndLineAlternate": 1, "StartColumn": 0, "EndColumn": 10, "FileName": "e:/prog/fsharp/FsAutoComplete/test/FsAutoComplete.Tests.Lsp/TestCases/AutocompleteScriptTest/Script.fsx", "$type": "FSharpDiagnostic"}]
Important part:
The .NET SDK for this script could not be determined. If the script is in a directory using a 'global.json' then ensure the relevant .NET SDK is installed. The output from '[...]\FsAutoComplete\test\FsAutoComplete.Tests.Lsp\bin\Debug\net5.0\FsAutoComplete.Tests.Lsp.exe --version' in the directory '[...]\FsAutoComplete\test\FsAutoComplete.Tests.Lsp\TestCases\AutocompleteScriptTest' was: 'Timeout executing command '[...]\FsAutoComplete\test\FsAutoComplete.Tests.Lsp\bin\Debug\net5.0\FsAutoComplete.Tests.Lsp.exe' '--version'' and the exit code was '1'.
-> it tried to run FsAutoComplete.Tests.Lsp.exe --version, which exited with 1 (I guess because of timeout: Before displaying the message the execution hangs for quite a while)
-> might be an error in Compiler Service? (Currently FsAutoComplete uses Compiler Service 39 -- an old version. But happens with #773 too). Or some setting in FSAutoComplete which overrides dotnet path?
(for testing I use while true do Thread.Sleep 1000 instead of exit 0 -> first --version-process stays open, but no further children are created)
But that's of course just hiding the problem, not fixing it...
After a bit more testing/examination:
The issue seems to be env variable DOTNET_HOST_PATH (which I haven't set):
The --version process has DOTNET_HOST_PATH = E:\prog\fsharp\FsAutoComplete\test\FsAutoComplete.Tests.Lsp\bin\Debug\net5.0\FsAutoComplete.Tests.Lsp.exe set. The root process (without --version) doesn't have DOTNET_HOST_PATH set.
Setting it at start of main (System.Environment.SetEnvironmentVariable("DOTNET_HOST_PATH", "dotnet")) or before running tests as real env variable ($ENV:DOTNET_HOST_PATH="dotnet" in powershell) results in no additional --version process.
-> if DOTNET_HOST_PATH isn't set before running the tests it will be set to the current exe.
I have no idea why or where this happens.
But workaround for now: set env var DOTNET_HOST_PATH to dotnet
The text was updated successfully, but these errors were encountered:
Wow, excellent detective work on both linked issues here! I'm not done ingesting the implications of the problem and your suggestions, but just wanted to shout out your snooping skills.
Tests (in
test/FsAutoComplete.Tests.Lsp
) can be run withdotnet test
(that's whatbuild.fsx
is using) anddotnet run
.For local testing/debugging I use the later option.
Now the issue: (only
![tree-window](https://user-images.githubusercontent.com/15612932/136839212-1da17e8b-4290-4927-862f-dcf20f15770f.png)
dotnet run
NOTdotnet test
)For certain tests the tests start itself again with
--version
as option (->FsAutoComplete.Tests.Lsp.exe --version
on windows) -- which again starts itself again with--version
which again starts itself etc. -> The tests are continuously started again as child and clog the system:When the first root test run finished (or is killed), the remaining
FsAutoComplete.Tests.Lsp
still remain active (all with--version
) (and the newest child again produces a new child which produces a new child etc.).After a while these processes use all available processing power... (-> kill processes in time with
Get-Process "FsAutoComplete.Tests.Lsp" | Stop-Process
orkillall FsAutoComplete.Tests.Lsp
)This happens on Windows (screenshot above), as well as on Linux (and wsl2):
![tree-linux](https://user-images.githubusercontent.com/15612932/136839230-1ab7705d-61b7-4ddd-97a0-7c794556b1cd.png)
Reproduction & Log
I'm not quite sure when exactly this occurs, but
dotnet run -- --filter "lsp.Ionide WorkspaceLoader.Autocomplete Tests"
seems to trigger it(exact test with error is
lsp.Ionide WorkspaceLoader.Autocomplete Tests.Autocomplete within script files.Get Autocomplete module members
, but just running this one test alone doesn't trigger the error)One interesting thing in the logs:
Important part:
-> it tried to run
FsAutoComplete.Tests.Lsp.exe --version
, which exited with1
(I guess because of timeout: Before displaying the message the execution hangs for quite a while)Location of error in code:
checker.GetProjectOptionsFromScriptFile
https://github.com/fsharp/FsAutoComplete/blob/478142949062ef25170b8b64f0df4e5a42cad326/src/FsAutoComplete.Core/CompilerServiceInterface.fs#L188I think the checker wants to call
dotnet --version
, but somehow uses the current exe? It would match this message indotnet/fsharp
tests-> might be an error in Compiler Service? (Currently FsAutoComplete uses Compiler Service 39 -- an old version. But happens with #773 too). Or some setting in FSAutoComplete which overrides
dotnet
path?Workaround:
Catch when the tests are called with
--version
and just exit: (intest/FsAutoComplete.Tests.Lsp/Program.fs
)(for testing I use
while true do Thread.Sleep 1000
instead ofexit 0
-> first--version
-process stays open, but no further children are created)But that's of course just hiding the problem, not fixing it...
After a bit more testing/examination:
The issue seems to be env variable
DOTNET_HOST_PATH
(which I haven't set):The
--version
process hasDOTNET_HOST_PATH = E:\prog\fsharp\FsAutoComplete\test\FsAutoComplete.Tests.Lsp\bin\Debug\net5.0\FsAutoComplete.Tests.Lsp.exe
set. The root process (without--version
) doesn't haveDOTNET_HOST_PATH
set.Setting it at start of main (
System.Environment.SetEnvironmentVariable("DOTNET_HOST_PATH", "dotnet")
) or before running tests as real env variable ($ENV:DOTNET_HOST_PATH="dotnet"
in powershell) results in no additional--version
process.-> if
DOTNET_HOST_PATH
isn't set before running the tests it will be set to the current exe.I have no idea why or where this happens.
But workaround for now: set env var
DOTNET_HOST_PATH
todotnet
The text was updated successfully, but these errors were encountered: