You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have searched YCM's issue tracker to find issues similar to the one I'm
about to report and couldn't find an answer to my problem. (Example Google
search.)
If filing a bug report, I have included the output of vim --version.
If filing a bug report, I have included the output of :YcmDebugInfo.
If filing a bug report, I have attached the contents of the logfiles using
the :YcmToggleLogs command.
If filing a bug report, I have included which OS (including specific OS
version) I am using.
If filing a bug report, I have included a minimal test case that reproduces
my issue, using vim -Nu /path/to/YCM/vimrc_ycm_minimal, including what I
expected to happen and what actually happened.
If filing a installation failure report, I have included the entire output
of install.py (or cmake/make/ninja) including its invocation
I understand this is an open-source project staffed by volunteers and
that any help I receive is a selfless, heartfelt gift of their free time. I
know I am not entitled to anything and will be polite and courteous.
I understand my issue may be closed if it becomes obvious I didn't
actually perform all of these steps.
Thank you for adhering to this process! It ensures your issue is resolved
quickly and that neither your nor our time is needlessly wasted.
Issue Details
Provide a clear description of the problem, including the following key
questions:
What did you do?
While doing Rust or TypeScript, when editing a file, it can temporarily becomes syntactically invalid. In some cases, this causes many syntax errors in lines below. For non-trivial files, this causes Vim to hang with 100 % CPU usage for up to 1 minute.
Include steps to reproduce here.
cargo init bla
cd bla
Put the code below in src/main.rs
cargo fmt
vim -Nu /path/to/YCM/ycm_vimrc_minimal src/main.rs
Vim hangs for multiple seconds, with 100 % CPU usage.
That code does look ridiculous, and the hang is only a few seconds in that case. However, it is note quite clear what characteristic of the code slows down YouCompleteMe. In any case, I get minute-long hangs with reasonable code in files of a few hundred lines.
Diagnostic data
Profiling
I profiled Vim while triggering this behavior on real code. I observe that 98 % of the CPU time is spent in <SNR>98_ReceiveMessages(). More specifically:
FUNCTION <SNR>98_ReceiveMessages()
Defined: ~/.vim/bundle/YouCompleteMe/autoload/youcompleteme.vim:104
Called 670 times
Total time: 59.753947962
Self time: 59.707860337
count total (s) self (s)
670 0.003721869 let poll_again = v:false
670 0.048781306 0.002693681 if s:AllowedToCompleteInCurrentBuffer()
670 59.692925947 let poll_again = py3eval( 'ycm_state.OnPeriodicTick()' )
670 0.000488217 endif
670 0.000571801 if poll_again
670 0.004631264 let s:pollers.receive_messages.id = timer_start( s:pollers.receive_messages.wait_milliseconds, function( 's:ReceiveMessages' ) )
else
" Don't poll again until we open another buffer
let s:pollers.receive_messages.id = -1
670 0.000316765 endif
OnPeriodicTick would be consistent with the fact that it happens a few moments after the edit. However, I do not know how to profile the Python code in the Vim context.
-- Resolve completions: Up front
-- Client logfile: /tmp/ycm_wlu_8erx.log
-- Server Python interpreter: /usr/bin/python3
-- Server Python version: 3.12.6
-- Server has Clang support compiled in: False
-- Clang version: None
-- No extra configuration file found
-- Rust completer debug information:
-- Rust Language Server running
-- Rust Language Server process ID: 2548558
-- Rust Language Server executable: ['/home/qsantos/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/rust-analyzer/bin/rust-analyzer']
-- Rust Language Server logfiles:
-- /tmp/rust_language_server_stderruuqqf1u9.log
-- Rust Language Server Server State: Initialized
-- Rust Language Server Project Directory: /home/qsantos/src/nhkeasier.com/nhkeasier
-- Rust Language Server Open Workspaces: {'/home/qsantos/src/nhkeasier.com/nhkeasier'}
-- Rust Language Server Settings: {}
-- Rust Language Server Project State: ready
-- Rust Language Server Version: 1.81.0-nightly (b5b1356 2024-06-10)
-- Rust Language Server Rust Root: /home/qsantos/.vim/bundle/YouCompleteMe/third_party/ycmd/third_party/rust-analyzer
-- Server running at: http://127.0.0.1:40919
-- Server process ID: 2548543
-- Server logfiles:
-- /tmp/ycmd_40919_stdout_d9se_jpe.log
-- /tmp/ycmd_40919_stderr_g7c0i3i2.log
-- Semantic highlighting supported: True
-- Virtual text supported: True
-- Popup windows supported: True
Output of YcmDiags
nhkeasier/src/router.rs [+]
nhkeasier/src/router.rs|643 col 1 error| Syntax Error: expected R_PAREN [syntax-error]
nhkeasier/src/router.rs|643 col 1 error| Syntax Error: expected COMMA [syntax-error]
nhkeasier/src/router.rs|643 col 1 error| Syntax Error: expected R_PAREN [syntax-error]
nhkeasier/src/router.rs|643 col 1 error| Syntax Error: expected SEMICOLON [syntax-error]
nhkeasier/src/router.rs|643 col 1 error| Syntax Error: expected R_CURLY [syntax-error]
nhkeasier/src/router.rs|127 col 13 error| Syntax Error: Invalid raw string literal [syntax-error]
[Location List] ycm_loc 1,1 All
Diagnostics refreshed
## Logs
They seem to contain nothing interesting.
2024-10-29T20:14:44.851340Z DEBUG GlobalState::handle_event{event=Event::Task}: rust_analyzer::main_loop: handle_event loop_start=Instant { tv_sec: 351660, tv_nsec: 177554679 } event=Diagnostics([(FileId(0), [])])
~
~
~
~
~
~
~
~
~
~
~
/tmp/rust_language_server_stderr95lryoif.log
b'{"filepath": "/home/qsantos/bla/src/main.rs", "line_num": 1, "column_num": 1, "working_dir": "/home/qsantos/bla", "file_data": {"/home/qsantos/bla/src/main.rs": {"contents": "fn main() {\\n \\"Hello, World!\\";\\n}\\n\\nfn a() {\\n if true {\\n if true {\\n if true {\\n if true {\\n if true {\\n if true {\\n if true {\\n if true {\\n if true {\\n if true {\\n if true {\\n if true {\\n if true {\\n if true {\\n if true {\\n if true {\\n if true {\\n if true {\\n if true {\\n if true {\\n if true {\\n if true {\\n if true\\n {\\n if true { if true { if true { if true { if true { if true { if true { if true { if true { if true { if true { if true { if true { if true { if true { if true { if true { if true { if true { if true { if true { if true { if true { if true { if true { if true { if true { if true { if true { if true { if true { if true { if true { if true { if true { if true { if true { if true { if true { if true { if true { if true { if true { if true { if true { if true { if true { if true { println!(\\"Hello, World!\\"); } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } } }\\n }\\n }\\n }\\n }\\n }\\n
/tmp/ycm_i2ly9a4g.log
2024-10-29 21:14:56,421 - DEBUG - in-event <InotifyEvent: src_path=b'/home/qsantos/bla', wd=1, mask=IN_ISDIR|IN_OPEN, cookie=0, name=''>
127.0.0.1 - - [29/Oct/2024 21:14:59] "POST /debug_info HTTP/1.1" 200 892
2024-10-29 21:15:00,506 - DEBUG - in-event <InotifyEvent: src_path=b'/home/qsantos/bla', wd=1, mask=IN_ISDIR|IN_OPEN, cookie=0, name=''>
2024-10-29 21:15:00,506 - DEBUG - in-event <InotifyEvent: src_path=b'/home/qsantos/bla', wd=1, mask=IN_ISDIR|IN_OPEN, cookie=0, name=''>
2024-10-29 21:15:00,506 - DEBUG - in-event <InotifyEvent: src_path=b'/home/qsantos/bla', wd=1, mask=IN_ISDIR|IN_OPEN, cookie=0, name=''>
2024-10-29 21:15:00,506 - DEBUG - in-event <InotifyEvent: src_path=b'/home/qsantos/bla', wd=1, mask=IN_ISDIR|IN_OPEN, cookie=0, name=''>
~
~
~
~
~
~
/tmp/ycmd_55049_stderr_rql071k4.log
serving on http://localhost:55049
~
~
~
~
~
~
~
~
~
~
~
/tmp/ycmd_55049_stdout_f0edk6fw.log
Output of git rev-parse HEAD in YouCompleteMe installation directory
35d188247bb481ed721584612fea4736a373e8ca
Contents of YCM, ycmd and completion engine logfiles
Reproduce the issue with vim -Nu /path/to/YCM/vimrc_ycm_minimal, which
enabled debug logging and other useful diagnostics. Include a link to a gist containing all of the log files listed by :YcmToggleLogs.
OS version, distribution, etc.
Debian 13 / testing / trixie.
Output of build/install commands
I used ./install.sh --rust-completer --ts-completer to install YouCompleteMe. Note that I also encountered the issue with TypeScript files, so it is not specific to rust-analzyer.
The text was updated successfully, but these errors were encountered:
Sorry for the late response. I can repro the high cpu usage, but only for a few seconds, at least in C++.
Vim is known to struggle with really long lines. After running the snippet through a formatter I do not see a problem with performance.
That's not to say things can not be improved, but that would require deeper analysis.
Issue Prelude
Please complete these steps and check these boxes (by putting an
x
insidethe brackets) before filing your issue:
Frequently Asked Questions section.
about to report and couldn't find an answer to my problem. (Example Google
search.)
vim --version
.:YcmDebugInfo
.the
:YcmToggleLogs
command.version) I am using.
my issue, using
vim -Nu /path/to/YCM/vimrc_ycm_minimal
, including what Iexpected to happen and what actually happened.
of
install.py
(orcmake
/make
/ninja
) including its invocationthat any help I receive is a selfless, heartfelt gift of their free time. I
know I am not entitled to anything and will be polite and courteous.
actually perform all of these steps.
Thank you for adhering to this process! It ensures your issue is resolved
quickly and that neither your nor our time is needlessly wasted.
Issue Details
While doing Rust or TypeScript, when editing a file, it can temporarily becomes syntactically invalid. In some cases, this causes many syntax errors in lines below. For non-trivial files, this causes Vim to hang with 100 % CPU usage for up to 1 minute.
cargo init bla
cd bla
src/main.rs
cargo fmt
vim -Nu /path/to/YCM/ycm_vimrc_minimal src/main.rs
r#
(jwir#<Esc>
)I can continue interacting with Vim normally.
Vim hangs for multiple seconds, with 100 % CPU usage.
That code does look ridiculous, and the hang is only a few seconds in that case. However, it is note quite clear what characteristic of the code slows down YouCompleteMe. In any case, I get minute-long hangs with reasonable code in files of a few hundred lines.
Diagnostic data
Profiling
I profiled Vim while triggering this behavior on real code. I observe that 98 % of the CPU time is spent in
<SNR>98_ReceiveMessages()
. More specifically:OnPeriodicTick
would be consistent with the fact that it happens a few moments after the edit. However, I do not know how to profile the Python code in the Vim context.Output of
vim --version
Output of
YcmDebugInfo
Output of
YcmDiags
## Logs
They seem to contain nothing interesting.
Output of
git rev-parse HEAD
in YouCompleteMe installation directoryContents of YCM, ycmd and completion engine logfiles
OS version, distribution, etc.
Debian 13 / testing / trixie.
Output of build/install commands
I used
./install.sh --rust-completer --ts-completer
to install YouCompleteMe. Note that I also encountered the issue with TypeScript files, so it is not specific torust-analzyer
.The text was updated successfully, but these errors were encountered: