Kotlin构建导致JVM出现分段错误

时间:2017-04-25 09:14:18

标签: gradle kotlin

我有一个使用Gradle构建的Kotlin + Java项目。这是我正在使用的命令:

./gradlew "-Pkotlin.incremental=false" --info clean build javadoc

此外,我的GRADLE_OPTS设置为:

GRADLE_OPTS: "-Dorg.gradle.daemon=false -Dorg.gradle.parallel=false"

这是我得到的错误:

Could not perform non-incremental compilation with Kotlin compile daemon, non-incremental compilation in fallback mode will be performed
Could not connect to kotlin daemon. Using fallback strategy.
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f3b93fffeee, pid=8, tid=0x00007f3b954fb700
#
# JRE version: Java(TM) SE Runtime Environment (8.0_121-b13) (build 1.8.0_121-b13)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.121-b13 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# V  [libjvm.so+0x6e2eee]  jni_SetStaticIntField+0xee

有一个文件写入(hs_err_pid8.log或类似的东西),但这是在CI机器上,我无法读取它,因为CI在构建完成时销毁容器(成功或失败) )。有什么我可以尝试或以任何方式进行进一步的诊断,或者是否有人遇到过这个问题?

编辑好的,所以我能够获取SIGSEGV上生成的文件。这是巨大的,所以我将它附在一个pastebin:https://pastebin.com/Jkvp6uYx

现在我不确定相关部分是什么,但我确实看到了一个可能相关部分的堆栈跟踪(到目前为止的日志让我们相信这与gradle增量任务有关):

    Stack: [0x00007fc7f0ece000,0x00007fc7f0fcf000],  sp=0x00007fc7f0fc7b20,  free space=998k
    Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
    V  [libjvm.so+0x6e2eee]  jni_SetStaticIntField+0xee
    C  [libjansi.so+0xf38]  Java_org_fusesource_jansi_internal_CLibrary_init+0x108
    j  org.fusesource.jansi.internal.CLibrary.<clinit>()V+20
    v  ~StubRoutines::call_stub
    V  [libjvm.so+0x690dd6]  JavaCalls::call_helper(JavaValue*, methodHandle*, JavaCallArguments*, Thread*)+0x1056
    V  [libjvm.so+0x642be7]  InstanceKlass::call_class_initializer_impl(instanceKlassHandle, Thread*)+0xd7
    V  [libjvm.so+0x6451fc]  InstanceKlass::initialize_impl(instanceKlassHandle, Thread*)+0x1ac
    V  [libjvm.so+0x6455c1]  InstanceKlass::initialize(Thread*)+0x41
    V  [libjvm.so+0x7f3c2f]  LinkResolver::resolve_field(fieldDescriptor&, KlassHandle, Symbol*, Symbol*, KlassHandle, Bytecodes::Code, bool, bool, Thread*)+0x4df
    V  [libjvm.so+0x7f3e95]  LinkResolver::resolve_field_access(fieldDescriptor&, constantPoolHandle, int, Bytecodes::Code, Thread*)+0x245
    V  [libjvm.so+0x688d15]  InterpreterRuntime::resolve_get_put(JavaThread*, Bytecodes::Code)+0x125
    j  org.jetbrains.kotlin.cli.common.messages.PlainTextMessageRenderer.<clinit>()V+21
    v  ~StubRoutines::call_stub
    V  [libjvm.so+0x690dd6]  JavaCalls::call_helper(JavaValue*, methodHandle*, JavaCallArguments*, Thread*)+0x1056
    V  [libjvm.so+0x642be7]  InstanceKlass::call_class_initializer_impl(instanceKlassHandle, Thread*)+0xd7
    V  [libjvm.so+0x6451fc]  InstanceKlass::initialize_impl(instanceKlassHandle, Thread*)+0x1ac
    V  [libjvm.so+0x6455c1]  InstanceKlass::initialize(Thread*)+0x41
    V  [libjvm.so+0x64543d]  InstanceKlass::initialize_impl(instanceKlassHandle, Thread*)+0x3ed
    V  [libjvm.so+0x6455c1]  InstanceKlass::initialize(Thread*)+0x41
    V  [libjvm.so+0x6854fa]  InterpreterRuntime::_new(JavaThread*, ConstantPool*, int)+0x23a
    j  org.jetbrains.kotlin.cli.common.messages.MessageRenderer.<clinit>()V+10
    v  ~StubRoutines::call_stub
    V  [libjvm.so+0x690dd6]  JavaCalls::call_helper(JavaValue*, methodHandle*, JavaCallArguments*, Thread*)+0x1056
    V  [libjvm.so+0x642be7]  InstanceKlass::call_class_initializer_impl(instanceKlassHandle, Thread*)+0xd7
    V  [libjvm.so+0x6451fc]  InstanceKlass::initialize_impl(instanceKlassHandle, Thread*)+0x1ac
    V  [libjvm.so+0x6455c1]  InstanceKlass::initialize(Thread*)+0x41
    V  [libjvm.so+0x7f3c2f]  LinkResolver::resolve_field(fieldDescriptor&, KlassHandle, Symbol*, Symbol*, KlassHandle, Bytecodes::Code, bool, bool, Thread*)+0x4df
    V  [libjvm.so+0x7f3e95]  LinkResolver::resolve_field_access(fieldDescriptor&, constantPoolHandle, int, Bytecodes::Code, Thread*)+0x245
    V  [libjvm.so+0x688d15]  InterpreterRuntime::resolve_get_put(JavaThread*, Bytecodes::Code)+0x125
    j  org.jetbrains.kotlin.cli.common.CLICompiler.execAndOutputXml(Ljava/io/PrintStream;Lorg/jetbrains/kotlin/config/Services;[Ljava/lang/String;)Lorg/jetbrains/kotlin/cli/common/ExitCode;+123
    v  ~StubRoutines::call_stub
    V  [libjvm.so+0x690dd6]  JavaCalls::call_helper(JavaValue*, methodHandle*, JavaCallArguments*, Thread*)+0x1056
    V  [libjvm.so+0x99c357]  Reflection::invoke(instanceKlassHandle, methodHandle, Handle, bool, objArrayHandle, BasicType, objArrayHandle, bool, Thread*)+0x5d7
    V  [libjvm.so+0x99fa67]  Reflection::invoke_method(oopDesc*, Handle, objArrayHandle, Thread*)+0x147
    V  [libjvm.so+0x72447b]  JVM_InvokeMethod+0x26b
    J 1277  sun.reflect.NativeMethodAccessorImpl.invoke0(Ljava/lang/reflect/Method;Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object; (0 bytes) @ 0x00007fc7d9405bad [0x00007fc7d9405ac0+0xed]
    J 1276 C1 sun.reflect.NativeMethodAccessorImpl.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object; (104 bytes) @ 0x00007fc7d940627c [0x00007fc7d9405ee0+0x39c]
    J 8712 C2 java.lang.reflect.Method.invoke(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object; (62 bytes) @ 0x00007fc7da72c92c [0x00007fc7da72c8a0+0x8c]
    j  org.jetbrains.kotlin.compilerRunner.GradleCompilerRunner.compileInProcess([Ljava/lang/String;Ljava/lang/String;Lorg/jetbrains/kotlin/compilerRunner/GradleCompilerEnvironment;)Lorg/jetbrains/kotlin/cli/common/ExitCode;+142
    j  org.jetbrains.kotlin.compilerRunner.GradleCompilerRunner.compileWithDaemonOrFallback(Ljava/lang/String;Lorg/jetbrains/kotlin/cli/common/arguments/CommonCompilerArguments;Lorg/jetbrains/kotlin/compilerRunner/GradleCompilerEnvironment;)Lorg/jetbrains/kotlin/cli/common/ExitCode;+520

1 个答案:

答案 0 :(得分:4)

我把钱放在一个混乱的类路径中。你有2个版本的Kotlin stdlib(1.1.1和1.1-M2)以及kotlin-annotation-processing 1.1.0。

确保一切都在1.1.1(或现在的1.1.2-2)