Skip to content

A case of constant CPU usage #317

@vbfox

Description

@vbfox

So I started my investigation by noticing some nice RED power usage in Task Manager when I was doing something else than F#

image

Turns out it's an FSAC connected to Ionide in VSCode with my https://github.com/vbfox/MasterOfFoo project open... The CPU never goes down, always ~20%

Attaching a debugger show a constant barrage of background parsing :

fsautocomplete.exe Information: 0 : FCS: Unknown.TimeStampReferencedProject(g:\Code\MasterOfFoo\artifacts\BlackFox.MasterOfFoo\netstandard2.0\BlackFox.MasterOfFoo.dll).TryGetLogicalTimeStampForProject.CreateOneIncrementalBuilder (g:\Code\MasterOfFoo\src\BlackFox.MasterOfFoo\BlackFox.MasterOfFoo.fsproj)
fsautocomplete.exe Information: 0 : Reactor: 81,705.710 <-- Unknown.GetBackgroundCheckResultsForFileInProject, took 12.5769 ms
fsautocomplete.exe Information: 0 : Reactor: 81,705.711 pausing 10 milliseconds
fsautocomplete.exe Information: 0 : Reactor: 81,705.713 --> Unknown.GetBackgroundCheckResultsForFileInProject (g:\Code\MasterOfFoo\src\BlackFox.MasterOfFoo\FormatSpecification.fs), remaining 9
fsautocomplete.exe Information: 0 : FCS: Unknown.CreateOneIncrementalBuilder (g:\Code\MasterOfFoo\src\BlackFox.MasterOfFoo\BlackFox.MasterOfFoo.fsproj)
fsautocomplete.exe Information: 0 : Reactor: 81,705.731 enqueue Unknown.GetBackgroundCheckResultsForFileInProject (g:\Code\MasterOfFoo\src\BlackFox.MasterOfFoo\obj\Debug\net45\BlackFox.MasterOfFoo.AssemblyInfo.fs), length 9
fsautocomplete.exe Information: 0 : Reactor: 81,705.738 enqueue Unknown.GetBackgroundCheckResultsForFileInProject (g:\Code\MasterOfFoo\artifacts\Version.fs), length 10
fsautocomplete.exe Information: 0 : Reactor: 81,705.768 enqueue Unknown.GetBackgroundCheckResultsForFileInProject (g:\Code\MasterOfFoo\src\BlackFox.MasterOfFoo\FormatSpecification.fs), length 11
fsautocomplete.exe Information: 0 : Reactor: 81,705.768 <-- Unknown.GetBackgroundCheckResultsForFileInProject, took 54.5193 ms
fsautocomplete.exe Information: 0 : Reactor: 81,705.792 pausing 10 milliseconds
fsautocomplete.exe Information: 0 : Reactor: 81,705.793 --> Unknown.GetBackgroundCheckResultsForFileInProject (g:\Code\MasterOfFoo\src\BlackFox.MasterOfFoo\PrintableElement.fs), remaining 11
fsautocomplete.exe Information: 0 : Reactor: 81,705.812 enqueue Unknown.GetBackgroundCheckResultsForFileInProject (g:\Code\MasterOfFoo\src\BlackFox.MasterOfFoo\PrintableElement.fs), length 11
fsautocomplete.exe Information: 0 : Reactor: 81,705.812 <-- Unknown.GetBackgroundCheckResultsForFileInProject, took 17.3633 ms

Attaching a profiler show a single working thread doing things with a long tail of calls in TypeChecker (dotTrace file):

image

image

Ionide settings:

{
  "FSharp.showProjectExplorerIn": "fsharp",
  "FSharp.showCodeOutlineIn": "fsharp",
  "FSharp.codeOutline": false,
  "FSharp.minimizeBackgroundParsing": true,
  "FSharp.resolveNamespaces": false,
  "FSharp.externalAutocomplete": false,
  "FSharp.projectExplorer.autoReveal":"off",
  "FSharp.disableFailedProjectNotifications": true,
  "FSharp.lineLens.enabled": "always",
  "FSharp.showExplorerOnStartup": false
}

I didn't have language service requests debugging enabled so I'm not 100% sure that ionide wasn't the cause of the calls (But that would be surprising) enabling them live only give the websocket logs that looked like a repetition of the following lines :

[23:22:38 DEBUG] WebSocket message: '{"Kind":"errors","Data":{"File":"g:\\Code\\MasterOfFoo\\src\\BlackFox.MasterOfFoo\\FormatSpecification.fs","Errors":[]}}'
[23:22:38 DEBUG] WebSocket message: '{"Kind":"errors","Data":{"File":"g:\\Code\\MasterOfFoo\\src\\BlackFox.MasterOfFoo\\PrintableElement.fs","Errors":[]}}'
[23:22:38 DEBUG] WebSocket message: '{"Kind":"errors","Data":{"File":"g:\\Code\\MasterOfFoo\\src\\BlackFox.MasterOfFoo\\PrintfEnv.fs","Errors":[]}}'
[23:22:38 DEBUG] WebSocket message: '{"Kind":"errors","Data":{"File":"g:\\Code\\MasterOfFoo\\src\\BlackFox.MasterOfFoo\\Core.Helpers.fs","Errors":[]}}'
[23:22:38 DEBUG] WebSocket message: '{"Kind":"errors","Data":{"File":"g:\\Code\\MasterOfFoo\\src\\BlackFox.MasterOfFoo\\Core.FormatOptions.fs","Errors":[]}}'
[23:22:38 DEBUG] WebSocket message: '{"Kind":"errors","Data":{"File":"g:\\Code\\MasterOfFoo\\src\\BlackFox.MasterOfFoo\\Core.FormatString.fs","Errors":[]}}'
[23:22:38 DEBUG] WebSocket message: '{"Kind":"errors","Data":{"File":"g:\\Code\\MasterOfFoo\\src\\BlackFox.MasterOfFoo\\Core.FormatToString.fs","Errors":[]}}'
[23:22:38 DEBUG] WebSocket message: '{"Kind":"errors","Data":{"File":"g:\\Code\\MasterOfFoo\\src\\BlackFox.MasterOfFoo\\Core.PrintfBuilding.fs","Errors":[]}}'
[23:22:38 DEBUG] WebSocket message: '{"Kind":"errors","Data":{"File":"g:\\Code\\MasterOfFoo\\src\\BlackFox.MasterOfFoo\\Core.PrintfCache.fs","Errors":[]}}'
[23:22:38 DEBUG] WebSocket message: '{"Kind":"errors","Data":{"File":"g:\\Code\\MasterOfFoo\\src\\BlackFox.MasterOfFoo\\MasterOfFoo.fs","Errors":[]}}'
[23:22:38 DEBUG] WebSocket message: '{"Kind":"errors","Data":{"File":"g:\\Code\\MasterOfFoo\\src\\BlackFox.MasterOfFoo\\obj\\Debug\\net45\\BlackFox.MasterOfFoo.AssemblyInfo.fs","Errors":[]}}'
[23:22:38 DEBUG] WebSocket message: '{"Kind":"errors","Data":{"File":"g:\\Code\\MasterOfFoo\\artifacts\\Version.fs","Errors":[]}}'

The problem also doesn't reproduce on restart, so I guess nothing really actionable on this issue but I wanted the diagnostic info out there in case it happens to someone else and we can get more insight.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions