jessewilson
08/24/2026, 7:14 PMThe provisioning mechanism and all relevant behaviors in the Kotlin Toolchain are designed to be safe to use concurrently. This means you can run as many Kotlin CLI commands as you want in parallel, and they won't disturb each other.I just crashed it by attempting to run two builds on the same project at the same time.
00:02.547 WARN :api:resolveDependenciesWasmWasi Unexpected error occurred on the attempt to download kotlinx-coroutines-core-jvm-1.10.2.pom for dependency org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:1.10.2 (reason: java.io.IOException: Resource deadlock would occur): java.io.IOException: Resource deadlock would occurjessewilson
08/24/2026, 7:15 PMjava.io.IOException: Resource deadlock would occur
at java.base/sun.nio.ch.UnixFileDispatcherImpl.lock0(Native Method)
at java.base/sun.nio.ch.UnixFileDispatcherImpl.lock(UnixFileDispatcherImpl.java:107)
at java.base/sun.nio.ch.FileChannelImpl.lock(FileChannelImpl.java:1693)
at java.base/java.nio.channels.FileChannel.lock(FileChannel.java:1223)
at org.jetbrains.amper.concurrency.DoubleLockKt$lockWithRetry$3.invokeSuspend$lambda$0(doubleLock.kt:236)
at kotlinx.coroutines.InterruptibleKt.runInterruptibleInExpectedContext(Interruptible.kt:48)
at kotlinx.coroutines.InterruptibleKt.access$runInterruptibleInExpectedContext(Interruptible.kt:1)
at kotlinx.coroutines.InterruptibleKt$runInterruptible$2.invokeSuspend(Interruptible.kt:40)
at kotlinx.coroutines.InterruptibleKt$runInterruptible$2.invoke(Interruptible.kt)
at kotlinx.coroutines.InterruptibleKt$runInterruptible$2.invoke(Interruptible.kt)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndspatched(Undispatched.kt:66)
at kotlinx.coroutines.intrinsics.UndispatchedKt.startUndispatchedOrReturn(Undispatched.kt:43)
at kotlinx.coroutines.BuildersKt__Builders_commonKt.withContext(Builders.common.kt:157)
at kotlinx.coroutines.BuildersKt.withContext(Unknown Source)
at kotlinx.coroutines.InterruptibleKt.runInterruptible(Interruptible.kt:39)
at kotlinx.coroutines.InterruptibleKt.runInterruptible$default(Interruptible.kt:36)
at org.jetbrains.amper.concurrency.DoubleLockKt$lockWithRetry$3.invokeSuspend(doubleLock.kt:235)
at org.jetbrains.amper.concurrency.DoubleLockKt$lockWithRetry$3.invoke(doubleLock.kt)
at org.jetbrains.amper.concurrency.DoubleLockKt$lockWithRetry$3.invoke(doubleLock.kt)
at org.jetbrains.amper.concurrency.DoubleLockKt.withRetry-WPwdCS8(doubleLock.kt:255)
at org.jetbrains.amper.concurrency.DoubleLockKt.withRetry-WPwdCS8$default(doubleLock.kt:241)
at org.jetbrains.amper.concurrency.DoubleLockKt.lockWithRetry(doubleLock.kt:232)
at org.jetbrains.amper.concurrency.DoubleLockKt.getOrComputeWithDoubleLock(doubleLock.kt:331)
at org.jetbrains.amper.concurrency.DoubleLockKt$getOrComputeWithDoubleLock$1.invokeSuspend(doubleLock.kt)joffrey
08/24/2026, 7:41 PMjoffrey
08/24/2026, 7:42 PMResource deadlock avoided message, and your error seems really close, but not quite the same. Hence my question.jessewilson
08/24/2026, 7:46 PMjessewilson
08/24/2026, 7:47 PMSystem software
Linux Ubuntu LTS
22.04
System
docker
29.3.0
docker-buildx
0.32.1
docker-compose
2.40.3
git-lfs
3.3.0
node
20
Pre-installed
aws-cli
2.13.0
joffrey
08/24/2026, 7:48 PMjoffrey
08/24/2026, 7:50 PMjoffrey
08/24/2026, 7:51 PMjessewilson
08/24/2026, 8:20 PMBy the way, I see it's a warning there. Did it fail your build, or was the dependency resolved eventually?The build failed. Concretely, the
kotlin process returned a non-0 exit code. It printed a ton of warnings but nothing more severe than WARN, which seems like a different, complementary bugjessewilson
08/24/2026, 8:20 PMjessewilson
08/24/2026, 8:21 PMjoffrey
08/24/2026, 8:44 PMjoffrey
08/24/2026, 8:49 PMjessewilson
08/24/2026, 8:54 PMjoffrey
08/24/2026, 8:58 PMjessewilson
08/24/2026, 9:03 PMjessewilson
08/24/2026, 9:04 PMjoffrey
08/24/2026, 9:10 PMjessewilson
08/24/2026, 9:14 PMjessewilson
08/24/2026, 9:15 PMjessewilson
08/24/2026, 9:16 PMjessewilson
08/24/2026, 9:16 PMjessewilson
08/24/2026, 9:17 PMjessewilson
08/24/2026, 9:17 PMjoffrey
08/24/2026, 9:20 PMjoffrey
08/24/2026, 9:21 PMmaartenh
08/25/2026, 7:29 AMjoffrey
08/25/2026, 12:18 PMFrankly, while the OS may be freaking out unnecessarily, nobody would be happy with a policy that allowed the possibility of deadlockingI disagree here. It's good to have some safety net that fails early when there are problems, but it's not acceptable that it fails when the problem is not present. I'd rather have a policy that allows some deadlocks if applications are poorly written, than a policy that crashes well-behaved applications unnecessarily.
joffrey
08/25/2026, 12:23 PMI'm tempted to think that you could work around these issues by using something like a shared SQLite database to coordinate file locks. But that does add some overhead and I don't know if the performance slowdown would be a deal breaker.At the moment the only problem is that the error message for this OS error is unspecified, but with the 2 that we've seen, we should reasonably cover all supported OSes. These error messages don't change every day, and I'd be so bold as to say they are very unlikely to change at all. So, yes, it's in theory a brittle check, but in practice it's reasonable. So this check-message-and-retry behavior is pretty decent in the landscape of possibilities. Using more advanced ad-hoc synchronization mechanisms would complicate a lot the system and lose performance, just for a theoretical gain, so I'm not very keen to do that. And yes, a slowdown for the dependency resolution is kind of a deal breaker, because it's a part of the build that's on the critical path.
alexey.barsov
09/04/2026, 3:22 PMjessewilson
09/04/2026, 4:05 PMjessewilson
09/04/2026, 4:09 PMjoffrey
09/04/2026, 8:41 PMjoffrey
09/04/2026, 8:46 PMjoffrey
09/04/2026, 8:47 PM