gpt4 book ai didi

intellij-idea - IDEA 非法状态异常 : Service is dying when running JUnit test with Kotlin

转载 作者:行者123 更新时间:2023-12-03 16:21:07 28 4
gpt4 key购买 nike

昨天我正在处理我的代码库,我正在对我的代码运行单元测试,突然我在 IDEA 日志中看到了这个:

Error:Kotlin: [Internal Error] java.lang.IllegalStateException: Service is dying at org.jetbrains.kotlin.daemon.common.CompileService$CallResult$Dying.get(CompileService.kt:60) at org.jetbrains.kotlin.daemon.common.CompileService$CallResult$Dying.get(CompileService.kt:59) at org.jetbrains.kotlin.compilerRunner.JpsKotlinCompilerRunner.compileWithDaemon(JpsKotlinCompilerRunner.kt:127) at org.jetbrains.kotlin.compilerRunner.JpsKotlinCompilerRunner.compileWithDaemonOrFallback(JpsKotlinCompilerRunner.kt:100) at org.jetbrains.kotlin.compilerRunner.JpsKotlinCompilerRunner.compileWithDaemonOrFallback(JpsKotlinCompilerRunner.kt:35) at org.jetbrains.kotlin.compilerRunner.KotlinCompilerRunner.runCompiler(KotlinCompilerRunner.kt:115) at org.jetbrains.kotlin.compilerRunner.JpsKotlinCompilerRunner.runK2JvmCompiler(JpsKotlinCompilerRunner.kt:65) at org.jetbrains.kotlin.jps.build.KotlinBuilder.compileToJvm(KotlinBuilder.kt:740) at org.jetbrains.kotlin.jps.build.KotlinBuilder.doCompileModuleChunk(KotlinBuilder.kt:458) at org.jetbrains.kotlin.jps.build.KotlinBuilder.doBuild(KotlinBuilder.kt:264) at org.jetbrains.kotlin.jps.build.KotlinBuilder.build(KotlinBuilder.kt:181) at org.jetbrains.jps.incremental.IncProjectBuilder.runModuleLevelBuilders(IncProjectBuilder.java:1282) at org.jetbrains.jps.incremental.IncProjectBuilder.runBuildersForChunk(IncProjectBuilder.java:956) at org.jetbrains.jps.incremental.IncProjectBuilder.buildTargetsChunk(IncProjectBuilder.java:1028) at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunkIfAffected(IncProjectBuilder.java:915) at org.jetbrains.jps.incremental.IncProjectBuilder.buildChunks(IncProjectBuilder.java:741) at org.jetbrains.jps.incremental.IncProjectBuilder.runBuild(IncProjectBuilder.java:387) at org.jetbrains.jps.incremental.IncProjectBuilder.build(IncProjectBuilder.java:195) at org.jetbrains.jps.cmdline.BuildRunner.runBuild(BuildRunner.java:138) at org.jetbrains.jps.cmdline.BuildSession.runBuild(BuildSession.java:295) at org.jetbrains.jps.cmdline.BuildSession.run(BuildSession.java:125) at org.jetbrains.jps.cmdline.BuildMain$MyMessageHandler$1.run(BuildMain.java:238) at org.jetbrains.jps.service.impl.SharedThreadPoolImpl$1.run(SharedThreadPoolImpl.java:44) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745)

这是 JetBrains 开的愚人节玩笑吗?

我以前从未见过这个。 killall java 并重新启动 IDEA 解决了问题,但我无法重现此问题。这是记录在案的东西(我在谷歌上没有发现任何命中)还是编译 Kotlin 代码时 IDEA 中的一次性故障? 这个错误是什么意思?

请注意我运行的单元测试是一个简单的探索性测试,我认为它与这里无关:

internal fun fetchAsListWithSiblings(): List<Message<T>> {
val first = this
var currentMsg = first
val result = mutableListOf(currentMsg)
while(currentMsg.next.isPresent) {
val next = currentMsg.next.get()
currentMsg = next
result.add(next)
}
return result
}


@Test
fun shouldFetchSiblingsWhenFetchSiblingsIsCalledWithMultipleSiblings() {
val expected = listOf("foo", "bar", "baz")
val messages = Message.createMultiple(expected)

assertThat(messages.fetchAsListWithSiblings().map { it.payload }).isEqualTo(expected)
}

最佳答案

这是已知问题——并行编译开始时的竞争条件。通常重复构建即可解决。这是相关的issue KT-15562在 YouTrack 中。该问题应该最终在 Kotlin 1.1.2 版本中得到解决。

关于intellij-idea - IDEA 非法状态异常 : Service is dying when running JUnit test with Kotlin,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43172301/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com