I was able to resolve my specific issue.
My project is in python. My installed extensions are ms-python
and Ruff
.
I tried to change Python language server to all available options with no luck.
My deployment created many junk files and at some point there was about 40000 python files in the project folder. These junk files were mentioned in .gitignore
and never bothered me.
Problems started when I opened Cursor chat and send any request tagging only one file. Then in the Output of the Python Language Server I had:
2024-10-11 17:20:06.764 [info] [Info - 17:20:06] Emptying type cache to avoid heap overflow. Used 3686MB out of 4096MB.
2024-10-11 17:20:14.278 [info]
<--- Last few GCs --->
[33625:0x100006d0000] 203676 ms: Mark-Compact (reduce) 1574.6 (3029.2) -> 1553.0 (2876.5) MB, pooled: 0 MB, 430.12 / 0.00 ms (average mu = 0.885, current mu = 0.882) last resort; GC in old space requested
[33625:0x100006d0000] 204202 ms: Mark-Compact (reduce) 1553.0 (2876.5) -> 1553.0 (2779.2) MB, pooled: 0 MB, 526.12 / 0.00 ms (average mu = 0.738, current mu = 0.000) last resort; GC in old space requested
<--- JS stacktrace --->
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
2024-10-11 17:20:14.278 [info] 1: 0x11080a70c node::Buffer::New(v8::Isolate*, char*, unsigned long) [/Applications/Cursor.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
2: 0x11080a940 node::OnFatalError(char const*, char const*) [/Applications/Cursor.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
3: 0x10ad81b34 _$LT$font_types..tag..Tag$u20$as$u20$core..cmp..PartialEq$LT$$u5b$u8$u3b$$u20$4$u5d$$GT$$GT$::eq::h2db382261c616d4e [/Applications/Cursor.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
4: 0x10ad81ac8 _$LT$font_types..tag..Tag$u20$as$u20$core..cmp..PartialEq$LT$$u5b$u8$u3b$$u20$4$u5d$$GT$$GT$::eq::h2db382261c616d4e [/Applications/Cursor.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
5: 0x10af31f38 v8::CppHeap::wrapper_descriptor() const [/Applications/Cursor.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
6: 0x10af13938 v8::CppHeap::wrapper_descriptor() const [/Applications/Cursor.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
7: 0x109b42290 uv_tcp_simultaneous_accepts [/Applications/Cursor.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
8: 0x10b0c43dc v8::Platform::SystemClockTimeMillis() [/Applications/Cursor.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
9: 0x10b0c4290 v8::Platform::SystemClockTimeMillis() [/Applications/Cursor.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
10: 0x10b0c28e4 v8::Platform::SystemClockTimeMillis() [/Applications/Cursor.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
11: 0x10b1599e4 v8::Platform::SystemClockTimeMillis() [/Applications/Cursor.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
12: 0x10b1db89c v8::Platform::SystemClockTimeMillis() [/Applications/Cursor.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
13: 0x10b30ff10 v8::internal::TickSample::print() const [/Applications/Cursor.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
14: 0x157ea3574
15: 0x157e47c90
16: 0x150708af0
17: 0x157e0dd7c
18: 0x1511a5e70
19: 0x1511a5f4c
20: 0x15076a788
21: 0x1508163c0
22: 0x1511a61d8
23: 0x1511a6280
24: 0x157e0dd7c
25: 0x157e0dd7c
26: 0x157e0dd7c
27: 0x157e0dd7c
28: 0x1511a1e4c
29: 0x1501d7760
30: 0x1501d7b68
31: 0x1501d7d68
32: 0x150054460
33: 0x157e0b728
34: 0x157e0b418
35: 0x10ae981b8 v8::Unwinder::PCIsInV8(unsigned long, v8::MemoryRange const*, void*) [/Applications/Cursor.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
36: 0x10ad988f4 v8::Function::Call(v8::Local<v8::Context>, v8::Local<v8::Value>, int, v8::Local<v8::Value>*) [/Applications/Cursor.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
37: 0x110756304 node::CallbackScope::~CallbackScope() [/Applications/Cursor.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
38: 0x11075674c node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*, node::async_context) [/Applications/Cursor.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
39: 0x110799078 node::SetCppgcReference(v8::Isolate*, v8::Local<v8::Object>, void*) [/Applications/Cursor.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
40: 0x109b8e4a0 uv_check_start [/Applications/Cursor.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
41: 0x109b88b14 uv_run [/Applications/Cursor.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
42: 0x110756d54 node::MakeCallback(v8::Isolate*, v8::Local<v8::Object>, v8::Local<v8::Function>, int, v8::Local<v8::Value>*) [/Applications/Cursor.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
43: 0x11075789c node::SpinEventLoop(node::Environment*) [/Applications/Cursor.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
44: 0x109b9db90 v8::ValueSerializer::Delegate::HasCustomHostObject(v8::Isolate*) [/Applications/Cursor.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
45: 0x109b99950 ElectronInitializeICUandStartNode [/Applications/Cursor.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework]
46: 0x19e090274 start [/usr/lib/dyld]
And after that cmd+click stopped working, and also syntax highlighting stopped working. Cursor chat at the same time worked great.
Restart of the Cursor app, or restart of the python extension solved the issue, but the next question to chat broke it again.
I removed junk deployment files, and the issue is resolved. I have ~700 files in the project dir for now.
I would agree that 40000 files is a big number, but not too big. And obviously there is something wrong, that Cursor chat breaks something if there are too many files.
I suggest there is some sort of reindexing of all project files, and it causes memory error.
I hope that it can be fixed, and I hope my post would help someone in the short term.