[OnPremKubernetes] java.lang.IllegalMonitorStateException when committing changes to repo
Hey again,
I get the following errors in the space and vcs deployments when trying to commit changes to a repo:
java.util.concurrent.ExecutionException: java.lang.IllegalMonitorStateException: attempt to unlock lock, not locked by current thread by node id: 2ce5b355-2610-4b0a-8a18-2f3c5216fab9 thread-id: 0
at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396)
at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2096)
at jetbrains.vcs.server.redis.RedisDfsDbCache.timedWait(RedisDfsDbCache.kt:70)
at jetbrains.vcs.server.redis.RedisDfsDbCache.access$timedWait(RedisDfsDbCache.kt:91)
at jetbrains.vcs.server.redis.RedisDfsDbCache$locks$1.lock$lambda$0(RedisDfsDbCache.kt:29)
at kotlin.jdk7.AutoCloseableKt.closeFinally(AutoCloseable.kt:61)
at jetbrains.vcs.server.index.OrgIndexer.updateRepoFilesIndex(OrgIndexer.kt:268)
at jetbrains.vcs.server.index.OrgIndexer.access$updateRepoFilesIndex(OrgIndexer.kt:131)
at jetbrains.vcs.server.index.OrgIndexer$updateRepoFilesIndex$1.invokeSuspend(OrgIndexer.kt)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at libraries.io.DaemonThreadFactory.newThread$lambda$0(DaemonThreadFactory.kt:22)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.IllegalMonitorStateException: attempt to unlock lock, not locked by current thread by node id: 2ce5b355-2610-4b0a-8a18-2f3c5216fab9 thread-id: 0
at org.redisson.RedissonBaseLock.lambda$unlockAsync$2(RedissonBaseLock.java:323)
at java.base/java.util.concurrent.CompletableFuture.uniHandle(CompletableFuture.java:934)
at java.base/java.util.concurrent.CompletableFuture$UniHandle.tryFire(CompletableFuture.java:911)
at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510)
at java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2147)
at org.redisson.command.CommandBatchService.lambda$executeAsync$7(CommandBatchService.java:322)
at java.base/java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:863)
at java.base/java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:841)
at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510)
at java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2147)
at org.redisson.command.RedisCommonBatchExecutor.handleResult(RedisCommonBatchExecutor.java:162)
at org.redisson.command.RedisExecutor.checkAttemptPromise(RedisExecutor.java:478)
at org.redisson.command.RedisExecutor.lambda$execute$3(RedisExecutor.java:172)
at java.base/java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:863)
at java.base/java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:841)
at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510)
at java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2147)
at org.redisson.client.handler.CommandDecoder.decodeCommandBatch(CommandDecoder.java:318)
at org.redisson.client.handler.CommandDecoder.decodeCommand(CommandDecoder.java:210)
at org.redisson.client.handler.CommandDecoder.decode(CommandDecoder.java:137)
at org.redisson.client.handler.CommandDecoder.decode(CommandDecoder.java:113)
at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:510)
at io.netty.handler.codec.ReplayingDecoder.callDecode(ReplayingDecoder.java:366)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:279)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:722)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:658)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:584)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:995)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
... 1 common frames omitted
2023-01-17 13:11:45.787 [IndexWriter-1] ERROR j.vcs.server.index.OrgIndexer [repoId=automation-worker-test-test-repository-1-9f5ad80d, requestId=index-index-cec3-4] - Org indexing repo automation-worker-test-test-repository-1-9f5ad80d
java.util.concurrent.ExecutionException: java.lang.IllegalMonitorStateException: attempt to unlock lock, not locked by current thread by node id: 2ce5b355-2610-4b0a-8a18-2f3c5216fab9 thread-id: 0
at java.base/java.util.concurrent.CompletableFuture.reportGet(CompletableFuture.java:396)
at java.base/java.util.concurrent.CompletableFuture.get(CompletableFuture.java:2096)
at jetbrains.vcs.server.redis.RedisDfsDbCache.timedWait(RedisDfsDbCache.kt:70)
at jetbrains.vcs.server.redis.RedisDfsDbCache.access$timedWait(RedisDfsDbCache.kt:91)
at jetbrains.vcs.server.redis.RedisDfsDbCache$locks$1.lock$lambda$0(RedisDfsDbCache.kt:29)
at kotlin.jdk7.AutoCloseableKt.closeFinally(AutoCloseable.kt:61)
at jetbrains.vcs.server.index.OrgIndexer.updateRepoFilesIndex(OrgIndexer.kt:268)
at jetbrains.vcs.server.index.OrgIndexer.access$updateRepoFilesIndex(OrgIndexer.kt:131)
at jetbrains.vcs.server.index.OrgIndexer$updateRepoFilesIndex$1.invokeSuspend(OrgIndexer.kt)
at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at libraries.io.DaemonThreadFactory.newThread$lambda$0(DaemonThreadFactory.kt:22)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: java.lang.IllegalMonitorStateException: attempt to unlock lock, not locked by current thread by node id: 2ce5b355-2610-4b0a-8a18-2f3c5216fab9 thread-id: 0
at org.redisson.RedissonBaseLock.lambda$unlockAsync$2(RedissonBaseLock.java:323)
at java.base/java.util.concurrent.CompletableFuture.uniHandle(CompletableFuture.java:934)
at java.base/java.util.concurrent.CompletableFuture$UniHandle.tryFire(CompletableFuture.java:911)
at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510)
at java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2147)
at org.redisson.command.CommandBatchService.lambda$executeAsync$7(CommandBatchService.java:322)
at java.base/java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:863)
at java.base/java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:841)
at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510)
at java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2147)
at org.redisson.command.RedisCommonBatchExecutor.handleResult(RedisCommonBatchExecutor.java:162)
at org.redisson.command.RedisExecutor.checkAttemptPromise(RedisExecutor.java:478)
at org.redisson.command.RedisExecutor.lambda$execute$3(RedisExecutor.java:172)
at java.base/java.util.concurrent.CompletableFuture.uniWhenComplete(CompletableFuture.java:863)
at java.base/java.util.concurrent.CompletableFuture$UniWhenComplete.tryFire(CompletableFuture.java:841)
at java.base/java.util.concurrent.CompletableFuture.postComplete(CompletableFuture.java:510)
at java.base/java.util.concurrent.CompletableFuture.complete(CompletableFuture.java:2147)
at org.redisson.client.handler.CommandDecoder.decodeCommandBatch(CommandDecoder.java:318)
at org.redisson.client.handler.CommandDecoder.decodeCommand(CommandDecoder.java:210)
at org.redisson.client.handler.CommandDecoder.decode(CommandDecoder.java:137)
at org.redisson.client.handler.CommandDecoder.decode(CommandDecoder.java:113)
at io.netty.handler.codec.ByteToMessageDecoder.decodeRemovalReentryProtection(ByteToMessageDecoder.java:510)
at io.netty.handler.codec.ReplayingDecoder.callDecode(ReplayingDecoder.java:366)
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:279)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:357)
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1410)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:379)
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:365)
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:919)
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:166)
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:722)
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:658)
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:584)
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:496)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:995)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
Changes seem to commit anyways though.
Please sign in to leave a comment.
Till Rother thanks for this as well. We'll optimize the code to handle such exceptions gracefully, but again, nothing critical here :)
Hey Pavel Boger, I keep getting this error in computeservice as well:
The workers error out with the following logs:
Another thing regarding the error in the first post of the thread: I think it's occuring due to programming mistakes in the committed .kts file.
Till Rother, I just had a conversation with the team, one of the possible reasons for this exception is the lack of CPU resources. Could you please check if that's the case and try increasing the limits if necessary?
@...
I'm using a horizontal autoscaler with modified request-values, based on historic usage:
VCS
resources:
limits:
cpu: "1"
memory: 1500Mi
requests:
cpu: 300m
memory: 800Mi
Space
resources:
limits:
cpu: "2"
memory: 3Gi
requests:
cpu: 500m
memory: 2Gi
Packages
resources:
limits:
cpu: "1"
memory: 2Gi
requests:
cpu: 250m
memory: 800Mi
Computeservice
resources:
limits:
cpu: "2"
memory: 4Gi
requests:
cpu: 100m
memory: 800Mi
I also checked the tables vcsdfs.vcsrepoindexfiles and vcsdfs.vcsorgindexfiles and removed any file from s3 that wasn't referenced in the tables. After doing that, the error didn't turn up anymore in the vcs pods.