forcedotcom / Einstein-GPT-for-Developers

Einstein GPT For Developers
BSD 3-Clause "New" or "Revised" License
38 stars 9 forks source link

E4D can enter a non-terminating cpu loop when run alongside with apex prettier #70

Closed gbockus-sf closed 5 months ago

gbockus-sf commented 6 months ago

Summary

When IAC is enabled in E4D sometimes you will encounter a situation where the inline provider appears to get stuck in a trigger loop resulting in it consuming the CPU resource and causing VSCode to be sluggish.

The current guess is this is somehow related to the Apex prettier extension and some interaction between the two extensions. The case reported where it comes up most often is when formatting a file with apex prettier E4D will start to consume the CPU and has to be disabled to allow the file formatting to complete.

Steps To Reproduce:

  1. Install and configure both Apex Prettier & E4D
  2. Enable debug logging
  3. With IAC enabled attempt to use Apex prettier for file formatting
  4. If repo'd you will encounter a loop of inline autocomplete requests and will see output similar to the following

image (2)

Reported on a high end windows machine, but has also been seen by other member of the team across OS's.

Expected result

E4D should not lock up VSCode

Actual result

CPU is consumed with canceled IAC requests.

Additional information

User @jamessimone salesforce extension pack: 60.11.0 einstein for developers just updated to 0.45.1 this morning Windows 11 Enterprise 22H2 VS Code version: 1.88.1

gbockus-sf commented 6 months ago

Associated WI: https://gus.lightning.force.com/lightning/r/ADM_Work__c/a07EE00001rOoyaYAC/view

gbockus-sf commented 5 months ago

This turned out to be associated with the inlineSuggestDelay advanced setting that allows the user to add buffer time before processing IAC requests. The default is 250 ms. If this value is too large then we see a bunch of async calls piling up waiting which impact cpu/memory on the system.

jamessimone commented 5 months ago

Thanks again for your help with this!