From 10285b32f10e9568bd980574669ac9d1a6d4f617 Mon Sep 17 00:00:00 2001 From: "Alexander.Likhachev" Date: Fri, 9 Jun 2023 17:43:32 +0200 Subject: [PATCH] [Gradle] Restore special handling for OOM as a cause of RemoteException Fixup to KT-59191 --- .../kotlin/compilerRunner/GradleKotlinCompilerWork.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/compilerRunner/GradleKotlinCompilerWork.kt b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/compilerRunner/GradleKotlinCompilerWork.kt index b39eafbeb31..d559574163b 100644 --- a/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/compilerRunner/GradleKotlinCompilerWork.kt +++ b/libraries/tools/kotlin-gradle-plugin/src/common/kotlin/org/jetbrains/kotlin/compilerRunner/GradleKotlinCompilerWork.kt @@ -245,12 +245,12 @@ internal class GradleKotlinCompilerWork @Inject constructor( } bufferingMessageCollector.flush(messageCollector) exitCodeFromProcessExitCode(log, res.get()) - } catch (e: RemoteException) { - throw DaemonCrashedException(e) } catch (e: Throwable) { bufferingMessageCollector.flush(messageCollector) if (e is OutOfMemoryError || e.hasOOMCause()) { throw OOMErrorException(kotlinDaemonOOMHelperMessage) + } else if (e is RemoteException) { + throw DaemonCrashedException(e) } else { throw e }