Semantic tokens, document links and LSP intentions hold highlighting read actions while they wait for the language server

Abierto
#2,017 3 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
48/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Activo
Stack tecnológico
java

Línea de trabajo

Start with LSPSemanticTokensHighlightVisitor.getSemanticTokens, LSPDocumentLinkCollector.collect, and LSPIntentionCodeActionSupport.getCodeActionAt, then compare their waits with refreshWhenLoaded and pendingFuture as described in the issue. Check the referenced freezes and the existing behavior in #1871. Done means the highlighting passes do not hold a read lock while waiting for the language server, and resume when a reply arrives.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

bug codeAction documentLink not reproducible performance semantic tokens

Three freezes of LSP4IJ 0.21.0 in #2014, all at startup with probable cause LONG_READ_ACTION and the IDE killed, have highlighting threads waiting for a language server while they hold the read lock, while the EDT waits for the write lock:

Report IDE Freeze Waiting in
2116064504671633408 IntelliJ IDEA 262.10968.63 44 s LSPSemanticTokensHighlightVisitor.getSemanticTokens (line 203), and four more threads in LSPDocumentLinkCollector.collect (line 79)
2108943541375074304 RustRover 262.10968.75 41 s LSPDocumentLinkCollector.collect (line 79)
2116205187730509824 IntelliJ IDEA 262.10968.63 44 s LSPIntentionCodeActionSupport.getCodeActionAt (line 154), from LSPLazyCodeActionIntentionAction.getFamilyName in ShowIntentionsPass

Each waits in ProgressIndicatorUtils.awaitWithCheckCanceled, inside a tryRunReadAction of the highlighting. The code relies on a write action cancelling the pass's progress, so that awaitWithCheckCanceled throws and the read lock is released, as the comments of LSPSemanticTokensHighlightVisitor.getSemanticTokens and LSPIntentionCodeActionSupport.getCodeActionAt say. In these reports that didn't happen for 40 s or more. awaitWithCheckCanceled checks the progress every few milliseconds, so the progress wasn't cancelled.

In 0.30.0: unchanged. The three waits are still there (lines 203 and 79, and line 170 in getCodeActionAt); 2a5d0420 only made them null-safe. #1871 stopped the EDT from waiting for intention code actions, but ShowIntentionsPass still waits in its read action. I haven't reproduced the freezes on 0.30.0 yet.

Possible fix: don't wait in the passes. Use the reply if it's there, and otherwise return and restart the highlighting when it arrives, as #1871 does on the EDT (refreshWhenLoaded) and as the document links already do after a cancellation (pendingFuture).

Lenguaje dominante
Java
Estrellas
360
Forks
125
Merge medio
14 h 13 min
PR fusionados (30 d)
189

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de redhat-developer/lsp4ij

Todos los issues de redhat-developer/lsp4ij

Issues similares

Más issues de Java

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.