Skip to content

Use exec and not execSync in salesforcedx-vscode-apex to not freeze the extension host #7461

@nvuillam

Description

@nvuillam

I looked for hours why vscode-sfdx-hardis was freezing for 30 seconds after its startup

Then after a CPU Profile analysis.... it is salesforcedx-vscode-apex that was doing that.

Please can you fix this bug ?

Thanks !

cc @mitchspano

  The event-loop freeze is not vscode-sfdx-hardis

  The 15-20 s (here ~27 s) of blocking is the Salesforce Apex extension (salesforcedx-vscode-apex). Its findAndCheckOrphanedProcesses routine
  calls execSync at startup — a synchronous child-process spawn that pins the extension-host event loop for the entire duration of the child. On
  Windows that child is a process-listing command (wmic/tasklist/PowerShell), which is notoriously slow, and it's run in a loop:

  - findAndCheckOrphanedProcesses (execSync): 23,571 ms
  - canRunCheck → findAndCheckOrphanedProcesses (execSync): 3,778 ms
  - = ~27.3 s of synchronous blocking, 92 % of all spawn time and the single biggest non-idle cost in the whole 120 s window.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions