From 584e4094bd46ad29cdebf3674e4b831df9ffaa5f Mon Sep 17 00:00:00 2001 From: Andrey Zaytsev Date: Wed, 29 Oct 2025 00:39:00 +0100 Subject: [PATCH] [analyzer] bug: rogue cancellation thrown from lsp request of notification handler could destroy the entire server or client GitOrigin-RevId: 27528e5e0345bd5b3a702fa734c0c597dff8787e --- .../com/jetbrains/lsp/implementation/withLsp.kt | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/fleet/lsp.protocol/srcCommonMain/com/jetbrains/lsp/implementation/withLsp.kt b/fleet/lsp.protocol/srcCommonMain/com/jetbrains/lsp/implementation/withLsp.kt index ba5fe5414dc7..7e713e7fdcca 100644 --- a/fleet/lsp.protocol/srcCommonMain/com/jetbrains/lsp/implementation/withLsp.kt +++ b/fleet/lsp.protocol/srcCommonMain/com/jetbrains/lsp/implementation/withLsp.kt @@ -211,7 +211,7 @@ suspend fun withLsp( result ) }.onFailure { error -> - if (error is CancellationException) throw error + currentCoroutineContext().job.ensureActive() LOG.error(error) }.getOrNull() } @@ -231,7 +231,7 @@ suspend fun withLsp( data ) }.onFailure { decodingError -> - if (decodingError is CancellationException) throw decodingError + currentCoroutineContext().job.ensureActive() LOG.error(decodingError) }.getOrNull() } @@ -268,7 +268,7 @@ suspend fun withLsp( } } }.onFailure { error -> - if (error is CancellationException) throw error + currentCoroutineContext().job.ensureActive() LOG.error(error) } }