Exafunction / codeium

Other
235 stars 13 forks source link

Language server doesn't stop after VS Code is closed #5

Closed yiannis-had closed 1 year ago

yiannis-had commented 1 year ago
image

Shouldn't the language server process automatically stop and free up memory once VS Code is not running anymore?

pqn commented 1 year ago

Thanks for your report. Did you see just the one process, or are there more?

yiannis-had commented 1 year ago

Hi, it seems like it's only that one that stays running

yiannis-had commented 1 year ago

What's the status of this issue @pqn ? Are there plans to fix it?

yiannis-had commented 1 year ago
image

Now showing up twice

pqn commented 1 year ago

At this point we have a potential solution, will post here when that gets implemented.

duwejeferson commented 1 year ago

It happens on windows too. When i first saw it, it was peaking proccesing% and had 2 instances running.

dembeck commented 1 year ago

Every VSCode window that I open when the profile has Codeium installed, loads a new instance of the language server on Windows and Mac. The processes never exit, even after closing out of VSCode completely.

There is one exception to the above, where Codeium does exit the language server process. If you run Developer: Reload Window from the Command Palette in VSCode, when the window reloads it starts a new language server process for the just reloaded window, then after the new language server has started, it kills the old one for that window.

So the capability to kill the language process seems to already be in the code, it just is not being called when VSCode closes a window.

image

pqn commented 1 year ago

I've just released a pre-release version of the VS Code extension (1.3.66) intended to fix this issue. You can expect to see the processes take up to a minute to exit after VS Code is closed. Let me know if it works.

yiannis-had commented 1 year ago

Seems to work as expected for me now, nice work and thanks!

dembeck commented 1 year ago

Some of the language server processes exit, but not all of them.

Screenshot

Showing that there are two orphan language server processes and that VSCode is not running.

image

Log Files

For reference, the approximate time that VSCode had fully exited is 2023-08-19 22:27:25.906 which I got from the last timestamp in the VS Code main.log file.

2023-08-19 22:27:25.906 [info] Extension host with pid 952 exited with code: 0, signal: unknown.

8-Codeium.log 17-Codeium.log

PowerShell Get-Process Output

Name                       : language_server_windows_x64
Id                         : 15288
PriorityClass              : Normal
FileVersion                :
HandleCount                : 478
WorkingSet                 : 342511616
PagedMemorySize            : 1129873408
PrivateMemorySize          : 1129873408
VirtualMemorySize          : -1472839680
TotalProcessorTime         : 03:57:31.7343750
SI                         : 1
Handles                    : 478
VM                         : 7117094912
WS                         : 342511616
PM                         : 1129873408
NPM                        : 47888
Path                       : c:\Users\User\.vscode-insiders\extensions\codeium.codeium-1.3.66\dist\af7b239f16f676fb71e02fb70e8aabacdb31f4a0\language_server_windows_x64.exe
CommandLine                : c:\Users\User\.vscode-insiders\extensions\codeium.codeium-1.3.66\dist\af7b239f16f676fb71e02fb70e8aabacdb31f4a0\language_server_windows_x64.exe --api_server_url https://server.codeium.com --manager_dir
                             C:\Users\User\AppData\Local\Temp\b3ada67a-bd0b-460e-b25d-a215d66ed4fc\codeium\manager --detect_proxy=false --enable_lsp --enable_search_api --database_dir
                             C:\Users\User\.codeium\database\9c0694567290725d9dcba14ade58e297 --search_max_workspace_file_count 5000 --shutdown_on_heartbeat_failure --run_child --random_port
                             --random_port_dir=C:\Users\User\AppData\Local\Temp\b3ada67a-bd0b-460e-b25d-a215d66ed4fc\codeium\manager/child_random_port_1692268089231616200_1595375980019650755
                             --manager_lock_file=C:\Users\User\AppData\Local\Temp\b3ada67a-bd0b-460e-b25d-a215d66ed4fc\codeium\manager/locks/manager.lock --child_lock_file
                             C:\Users\User\AppData\Local\Temp\b3ada67a-bd0b-460e-b25d-a215d66ed4fc\codeium\manager/locks/child_lock_1692268089232682400_1519633536257698515
Parent                     :
Company                    :
CPU                        : 14251.734375
ProductVersion             :
Description                :
Product                    :
__NounName                 : Process
SafeHandle                 : Microsoft.Win32.SafeHandles.SafeProcessHandle
Handle                     : 4596
BasePriority               : 8
ExitCode                   :
HasExited                  : False
StartTime                  : 8/17/2023 3:28:09 AM
ExitTime                   :
MachineName                : .
MaxWorkingSet              : 1413120
MinWorkingSet              : 204800
Modules                    : {System.Diagnostics.ProcessModule (language_server_windows_x64.exe), System.Diagnostics.ProcessModule (ntdll.dll), System.Diagnostics.ProcessModule (KERNEL32.DLL), System.Diagnostics.ProcessModule
                             (KERNELBASE.dll)…}
NonpagedSystemMemorySize64 : 47888
NonpagedSystemMemorySize   : 47888
PagedMemorySize64          : 1129873408
PagedSystemMemorySize64    : 372168
PagedSystemMemorySize      : 372168
PeakPagedMemorySize64      : 1552539648
PeakPagedMemorySize        : 1552539648
PeakWorkingSet64           : 726835200
PeakWorkingSet             : 726835200
PeakVirtualMemorySize64    : 7324868608
PeakVirtualMemorySize      : -1265065984
PriorityBoostEnabled       : False
PrivateMemorySize64        : 1129873408
ProcessorAffinity          : 255
SessionId                  : 1
StartInfo                  :
Threads                    : {20208, 24812, 11684, 12212…}
VirtualMemorySize64        : 7117094912
EnableRaisingEvents        : False
StandardInput              :
StandardOutput             :
StandardError              :
WorkingSet64               : 342511616
SynchronizingObject        :
MainModule                 : System.Diagnostics.ProcessModule (language_server_windows_x64.exe)
PrivilegedProcessorTime    : 02:03:08.2187500
UserProcessorTime          : 01:54:23.5156250
ProcessName                : language_server_windows_x64
MainWindowHandle           : 0
MainWindowTitle            :
Responding                 : True
Site                       :
Container                  :
TotalRunningTime           : 2 Days 19 Hours 55 Min 06 Sec
CurrentSystemTime          : 8/19/2023 11:23:15 PM

Name                       : language_server_windows_x64
Id                         : 22764
PriorityClass              : Normal
FileVersion                :
HandleCount                : 417
WorkingSet                 : 75464704
PagedMemorySize            : 54358016
PrivateMemorySize          : 54358016
VirtualMemorySize          : 1507688448
TotalProcessorTime         : 00:02:25.9218750
SI                         : 1
Handles                    : 417
VM                         : 5802655744
WS                         : 75464704
PM                         : 54358016
NPM                        : 30400
Path                       : c:\Users\User\.vscode-insiders\extensions\codeium.codeium-1.3.66\dist\af7b239f16f676fb71e02fb70e8aabacdb31f4a0\language_server_windows_x64.exe
CommandLine                : c:\Users\User\.vscode-insiders\extensions\codeium.codeium-1.3.66\dist\af7b239f16f676fb71e02fb70e8aabacdb31f4a0\language_server_windows_x64.exe --api_server_url https://server.codeium.com --manager_dir
                             C:\Users\User\AppData\Local\Temp\3d20e49f-4bfb-4828-a661-8312e048cd75\codeium\manager --detect_proxy=false --enable_lsp --enable_search_api --database_dir
                             C:\Users\User\.codeium\database\9c0694567290725d9dcba14ade58e297 --search_max_workspace_file_count 5000 --shutdown_on_heartbeat_failure --run_child --random_port
                             --random_port_dir=C:\Users\User\AppData\Local\Temp\3d20e49f-4bfb-4828-a661-8312e048cd75\codeium\manager/child_random_port_1692509124474396100_4382941336900199774
                             --manager_lock_file=C:\Users\User\AppData\Local\Temp\3d20e49f-4bfb-4828-a661-8312e048cd75\codeium\manager/locks/manager.lock --child_lock_file
                             C:\Users\User\AppData\Local\Temp\3d20e49f-4bfb-4828-a661-8312e048cd75\codeium\manager/locks/child_lock_1692509124475397200_8176893870574908182
Parent                     :
Company                    :
CPU                        : 145.921875
ProductVersion             :
Description                :
Product                    :
__NounName                 : Process
SafeHandle                 : Microsoft.Win32.SafeHandles.SafeProcessHandle
Handle                     : 3840
BasePriority               : 8
ExitCode                   :
HasExited                  : False
StartTime                  : 8/19/2023 10:25:24 PM
ExitTime                   :
MachineName                : .
MaxWorkingSet              : 1413120
MinWorkingSet              : 204800
Modules                    : {System.Diagnostics.ProcessModule (language_server_windows_x64.exe), System.Diagnostics.ProcessModule (ntdll.dll), System.Diagnostics.ProcessModule (KERNEL32.DLL), System.Diagnostics.ProcessModule
                             (KERNELBASE.dll)…}
NonpagedSystemMemorySize64 : 30400
NonpagedSystemMemorySize   : 30400
PagedMemorySize64          : 54358016
PagedSystemMemorySize64    : 370824
PagedSystemMemorySize      : 370824
PeakPagedMemorySize64      : 112828416
PeakPagedMemorySize        : 112828416
PeakWorkingSet64           : 131985408
PeakWorkingSet             : 131985408
PeakVirtualMemorySize64    : 5810679808
PeakVirtualMemorySize      : 1515712512
PriorityBoostEnabled       : False
PrivateMemorySize64        : 54358016
ProcessorAffinity          : 255
SessionId                  : 1
StartInfo                  :
Threads                    : {23024, 20412, 31012, 30380…}
VirtualMemorySize64        : 5802655744
EnableRaisingEvents        : False
StandardInput              :
StandardOutput             :
StandardError              :
WorkingSet64               : 75464704
SynchronizingObject        :
MainModule                 : System.Diagnostics.ProcessModule (language_server_windows_x64.exe)
PrivilegedProcessorTime    : 00:00:38.8593750
UserProcessorTime          : 00:01:47.0625000
ProcessName                : language_server_windows_x64
MainWindowHandle           : 0
MainWindowTitle            :
Responding                 : True
Site                       :
Container                  :
TotalRunningTime           : 0 Days 00 Hours 57 Min 51 Sec
CurrentSystemTime          : 8/19/2023 11:23:16 PM
pqn commented 1 year ago

@dembeck can you try pre-release version 1.3.72 and let me know if that helps?

pqn commented 1 year ago

The fix will soon be deployed to the main extension and is in its final form in the latest pre-release extension (1.2.76). There is a new setting, codeium.aggressiveShutdown, which you can set to true to enable the fix. It will remain off by default due to risk of false shutdowns since this is overall a rare problem.

palsega commented 1 year ago

Listen guys I met this thing in my Android Studio installation. For your info I have a problem with start of Codeium Chat itself. AS comes to crash and language_server_windows_x64.exe is still in progress, two or more instances of it.

Android Studio Iguana | 2023.2.1 Canary 14 Build #AI-232.10227.8.2321.11110254, built on November 16, 2023 Runtime version: 17.0.9+7-b1000.47 amd64 VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o. Windows 11.0 GC: G1 Young Generation, G1 Old Generation Memory: 2048M Cores: 4 Registry: debugger.new.tool.window.layout=true ide.experimental.ui=true

Non-Bundled Plugins: com.codeium.intellij (1.4.11) com.github.dinbtechit.vscodetheme (1.10.7)