emacs-lsp / lsp-ui

UI integrations for lsp-mode
https://emacs-lsp.github.io/lsp-ui
GNU General Public License v3.0
1.03k stars 141 forks source link

Reproducible hang with 100% CPU in lsp-ui-sideline--current-column #598

Closed madscientist closed 3 years ago

madscientist commented 3 years ago

I am using Emacs 27.1 on Ubuntu 20.04, and I also pulled the code for Emacs 27.2 and compiled it myself with debugging and see the same issue there: when editing an empty file (python file, in fact it's a __init__.py file) after I type a few characters Emacs hangs hard using 100% CPU, and no amount of ^G etc. will unblock it.

Looking at the stacktrace, it seems to be hanging in lsp-ui-sideline-current-column. All I can assume is that this loop is never exiting in my buffer; maybe because I'm on the first line and there's no previous line?

        (while (and (<= start (point)) (not (bobp)))
          (setq col (current-column))
          (with-no-warnings (ignore-errors (previous-line))))))

GDB says:

Lisp Backtrace:
"display-graphic-p" (0x6404d8a0)
"if" (0x6404daa0)
"eval" (0x6404dd58)
"posn-at-point" (0x64054590)
"line-move-visual" (0x64054b40)
"line-move" (0x640550a0)
"previous-line" (0x64055570)
"lsp-ui-sideline--current-column" (0x64055a20)
"lsp-ui-sideline--align" (0x64055f70)
"lsp-ui-sideline--diagnostics" (0x640565a8)
"lsp-ui-sideline--run" (0x64056ca0)
0x1db6ac10 PVEC_COMPILED
"apply" (0x640572e8)
"timer-event-handler" (0x64057838)

If I continue back up through these stack elements until it gets back to lsp-ui-sideline--current-column it will never return from that function.

madscientist commented 3 years ago

FYI if I set lsp-ui-sideline-enable to nil then the hang goes away.

jcs090218 commented 3 years ago

Okay let me revert the changes. Sorry for the inconvenience!