From 80fb9b84732324979db2d152663e5222847da1f7 Mon Sep 17 00:00:00 2001 From: Ilya Chernikov Date: Sun, 25 Oct 2015 18:40:40 +0100 Subject: [PATCH] Removing try/catch in the lock file acquiring algo, to avoid hanging like in case described here - https://devnet.jetbrains.com/message/5561306 it should now fail and fallback to in-process compilation --- .../jetbrains/kotlin/rmi/kotlinr/KotlinCompilerClient.kt | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/compiler/rmi/kotlinr/src/org/jetbrains/kotlin/rmi/kotlinr/KotlinCompilerClient.kt b/compiler/rmi/kotlinr/src/org/jetbrains/kotlin/rmi/kotlinr/KotlinCompilerClient.kt index 2bf4b1724ae..afd46aac493 100644 --- a/compiler/rmi/kotlinr/src/org/jetbrains/kotlin/rmi/kotlinr/KotlinCompilerClient.kt +++ b/compiler/rmi/kotlinr/src/org/jetbrains/kotlin/rmi/kotlinr/KotlinCompilerClient.kt @@ -402,12 +402,9 @@ public object KotlinCompilerClient { val maxAttempts = COMPILE_DAEMON_STARTUP_LOCK_TIMEOUT_MS / COMPILE_DAEMON_STARTUP_LOCK_TIMEOUT_CHECK_MS + 1 var attempt = 0L while (true) { - try { - if (lockFile.createNewFile()) break - // attempt to delete if file is orphaned - if (lockFile.delete() && lockFile.createNewFile()) break - } - catch (e: IOException) {} // Ignoring it - assuming it is another client process owning it + if (lockFile.createNewFile()) break + // attempt to delete if file is orphaned + if (lockFile.delete() && lockFile.createNewFile()) break if (lockFile.exists() && ++attempt >= maxAttempts) throw IOException("Timeout waiting the release of the lock file '${lockFile.absolutePath}") Thread.sleep(COMPILE_DAEMON_STARTUP_LOCK_TIMEOUT_CHECK_MS)