Skip to content

JvmCrashExamples Symbolic + Fuzzing mode produces errors with JDK 17 #1308

Closed
@alisevych

Description

@alisevych

Description

JvmCrashExamples Symbolic + Fuzzing mode (default) generation produce errors in test class.

To Reproduce

  1. Install build from release branch into IDEA 2022.2.3
  2. Create IntelliJ project with JDK 17
  3. Copy-paste JvmCrashExamples to it
  4. Generate tests for it in default Fuzzing + Symbolic mode

Expected behavior

Tests are supposed to be generated without errors.

Actual behavior

An error test is generated with information about exceptions.

Visual proofs (screenshots, logs, images)

    ///region

    @Test
    @Disabled(value = "Disabled due to possible JVM crash")
    public void testCrash1() throws Exception {
        JvmCrashExamples jvmCrashExamples = new JvmCrashExamples();

        // This invocation possibly crashes JVM
        jvmCrashExamples.crash(1);
    }
    ///endregion

    ///region Errors report for crash

    public void testCrash_errors() {
        // Couldn't generate some tests. List of errors:
        // 
        // 4 occurrences of:
        /* Unable to make field static final java.lang.ref.ReferenceQueue java.lang.ref.ReferenceQueue.NULL accessible: module
        java.base does not "opens java.lang.ref" to unnamed module @358c99f5 */

        // 2 occurrences of:
        /* Unable to make field private static long java.lang.ref.SoftReference.clock accessible: module
        java.base does not "opens java.lang.ref" to unnamed module @358c99f5 */

    }
    ///endregion

    ///endregion

    ///region Test suites for executable exceptions.JvmCrashExamples.crashPrivileged

    ///region

    @Test
    @Disabled(value = "Disabled due to possible JVM crash")
    public void testCrashPrivileged1() {
        JvmCrashExamples jvmCrashExamples = new JvmCrashExamples();

        // This invocation possibly crashes JVM
        jvmCrashExamples.crashPrivileged(1);
    }
    ///endregion

    ///region Errors report for crashPrivileged

    public void testCrashPrivileged_errors() {
        // Couldn't generate some tests. List of errors:
        // 
        // 1 occurrences of:
        /* Unable to make field static final boolean java.security.AccessController.$assertionsDisabled accessible: module
        java.base does not "opens java.security" to unnamed module @358c99f5 */

    }
    ///endregion

    ///endregion

Also there are the following exceptions in rdEngineProcessLogs:

17:29:42.945 | ERROR | UtBotSymbolicEngine | Test generation failed on stmt $z0 = <java.security.AccessController: boolean $assertionsDisabled>, symbolic stack trace:
<java.security.AccessController: java.lang.Object executePrivileged(java.security.PrivilegedAction,java.security.AccessControlContext,java.lang.Class)>
<java.security.AccessController: java.lang.Object doPrivileged(java.security.PrivilegedAction)>
<exceptions.JvmCrashExamples: int crashPrivileged(int)>
java.lang.reflect.InaccessibleObjectException: Unable to make field static final boolean java.security.AccessController.$assertionsDisabled accessible: module java.base does not "opens java.security" to unnamed module @358c99f5
	at java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:354) ~[?:?]
	at java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:297) ~[?:?]
	at java.lang.reflect.Field.checkCanSetAccessible(Field.java:178) ~[?:?]
	at java.lang.reflect.Field.setAccessible(Field.java:172) ~[?:?]
	at org.utbot.engine.Traverser.extractConcreteValue(Traverser.kt:3723) ~[utbot-framework-2022.11.500..jar:?]
	at org.utbot.engine.Traverser.makeConcreteUpdatesForNonEnumStaticField(Traverser.kt:621) ~[utbot-framework-2022.11.500..jar:?]
	at org.utbot.engine.Traverser.processStaticFieldConcretely(Traverser.kt:530) ~[utbot-framework-2022.11.500..jar:?]
	at org.utbot.engine.Traverser.processStaticInitializer(Traverser.kt:430) ~[utbot-framework-2022.11.500..jar:?]
	at org.utbot.engine.Traverser.processStaticInitializerIfRequired(Traverser.kt:384) ~[utbot-framework-2022.11.500..jar:?]
	at org.utbot.engine.Traverser.doPreparatoryWorkIfRequired(Traverser.kt:357) ~[utbot-framework-2022.11.500..jar:?]
	at org.utbot.engine.Traverser.traverseStmt(Traverser.kt:321) ~[utbot-framework-2022.11.500..jar:?]
	at org.utbot.engine.Traverser.traverse(Traverser.kt:304) ~[utbot-framework-2022.11.500..jar:?]
	at org.utbot.engine.UtBotSymbolicEngine$traverseImpl$1.invokeSuspend(UtBotSymbolicEngine.kt:360) ~[utbot-framework-2022.11.500..jar:?]
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) ~[kotlin-stdlib-1.7.20.jar:1.7.20-release-201(1.7.20)]
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:106) ~[kotlinx-coroutines-core-jvm-1.6.3.jar:?]
	at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:284) ~[kotlinx-coroutines-core-jvm-1.6.3.jar:?]
	at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85) ~[kotlinx-coroutines-core-jvm-1.6.3.jar:?]
	at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59) ~[kotlinx-coroutines-core-jvm-1.6.3.jar:?]
	at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source) ~[kotlinx-coroutines-core-jvm-1.6.3.jar:?]
	at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38) ~[kotlinx-coroutines-core-jvm-1.6.3.jar:?]
	at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source) ~[kotlinx-coroutines-core-jvm-1.6.3.jar:?]
	at org.utbot.framework.process.RdSettingsContainer$settingFor$1$1.getValue(RdSettingsContainer.kt:32) ~[utbot-framework-2022.11.500..jar:?]
	at org.utbot.framework.UtSettings.getCheckSolverTimeoutMillis(UtSettings.kt:46) ~[utbot-framework-api-2022.11.500..jar:?]
	at org.utbot.engine.pc.UtSolver.<init>(UtSolver.kt:125) ~[utbot-framework-2022.11.500..jar:?]
	at org.utbot.engine.pc.UtSolver.<init>(UtSolver.kt:165) ~[utbot-framework-2022.11.500..jar:?]
	at org.utbot.engine.UtBotSymbolicEngine$traverseImpl$1.invokeSuspend(UtBotSymbolicEngine.kt:258) ~[utbot-framework-2022.11.500..jar:?]
	at org.utbot.engine.UtBotSymbolicEngine$traverseImpl$1.invoke(UtBotSymbolicEngine.kt) ~[utbot-framework-2022.11.500..jar:?]
	at org.utbot.engine.UtBotSymbolicEngine$traverseImpl$1.invoke(UtBotSymbolicEngine.kt) ~[utbot-framework-2022.11.500..jar:?]
	at kotlinx.coroutines.flow.SafeFlow.collectSafely(Builders.kt:61) ~[kotlinx-coroutines-core-jvm-1.6.3.jar:?]
	at kotlinx.coroutines.flow.AbstractFlow.collect(Flow.kt:230) ~[kotlinx-coroutines-core-jvm-1.6.3.jar:?]
	at kotlinx.coroutines.flow.FlowKt__EmittersKt$onStart$$inlined$unsafeFlow$1.collect(SafeCollector.common.kt:120) ~[kotlinx-coroutines-core-jvm-1.6.3.jar:?]
	at kotlinx.coroutines.flow.FlowKt__EmittersKt$onCompletion$$inlined$unsafeFlow$1.collect(SafeCollector.common.kt:114) ~[kotlinx-coroutines-core-jvm-1.6.3.jar:?]
	at kotlinx.coroutines.flow.FlowKt__CollectKt.emitAll(Collect.kt:109) ~[kotlinx-coroutines-core-jvm-1.6.3.jar:?]
	at kotlinx.coroutines.flow.FlowKt.emitAll(Unknown Source) ~[kotlinx-coroutines-core-jvm-1.6.3.jar:?]
	at kotlinx.coroutines.flow.FlowKt__MergeKt$flattenConcat$1$1.emit(Merge.kt:80) ~[kotlinx-coroutines-core-jvm-1.6.3.jar:?]
	at kotlinx.coroutines.flow.FlowKt__MergeKt$flattenConcat$1$1.emit(Merge.kt:80) ~[kotlinx-coroutines-core-jvm-1.6.3.jar:?]
	at kotlinx.coroutines.flow.FlowKt__BuildersKt$flowOf$$inlined$unsafeFlow$1.collect(SafeCollector.common.kt:114) ~[kotlinx-coroutines-core-jvm-1.6.3.jar:?]
	at kotlinx.coroutines.flow.FlowKt__BuildersKt$flowOf$$inlined$unsafeFlow$1$1.invokeSuspend(SafeCollector.common.kt) ~[kotlinx-coroutines-core-jvm-1.6.3.jar:?]
	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33) ~[kotlin-stdlib-1.7.20.jar:1.7.20-release-201(1.7.20)]
	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:104) ~[kotlinx-coroutines-core-jvm-1.6.3.jar:?]
	at kotlinx.coroutines.EventLoopImplBase.processNextEvent(EventLoop.common.kt:284) ~[kotlinx-coroutines-core-jvm-1.6.3.jar:?]
	at kotlinx.coroutines.BlockingCoroutine.joinBlocking(Builders.kt:85) ~[kotlinx-coroutines-core-jvm-1.6.3.jar:?]
	at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking(Builders.kt:59) ~[kotlinx-coroutines-core-jvm-1.6.3.jar:?]
	at kotlinx.coroutines.BuildersKt.runBlocking(Unknown Source) ~[kotlinx-coroutines-core-jvm-1.6.3.jar:?]
	at kotlinx.coroutines.BuildersKt__BuildersKt.runBlocking$default(Builders.kt:38) ~[kotlinx-coroutines-core-jvm-1.6.3.jar:?]
	at kotlinx.coroutines.BuildersKt.runBlocking$default(Unknown Source) ~[kotlinx-coroutines-core-jvm-1.6.3.jar:?]
	at org.utbot.common.ConcurrencyKt.runBlockingWithCancellationPredicate(Concurrency.kt:38) ~[utbot-core-2022.11.500..jar:?]
	at org.utbot.framework.plugin.api.TestCaseGenerator$generate$3.invoke(TestCaseGenerator.kt:157) ~[utbot-framework-2022.11.500..jar:?]
	at org.utbot.framework.plugin.api.TestCaseGenerator$generate$3.invoke(TestCaseGenerator.kt:156) ~[utbot-framework-2022.11.500..jar:?]
	at org.utbot.common.ConcurrencyKt.runIgnoringCancellationException(Concurrency.kt:47) ~[utbot-core-2022.11.500..jar:?]
	at org.utbot.framework.plugin.api.TestCaseGenerator.generate(TestCaseGenerator.kt:156) ~[utbot-framework-2022.11.500..jar:?]
	at org.utbot.framework.process.EngineMainKt$setup$3.invoke(EngineMain.kt:104) ~[utbot-framework-2022.11.500..jar:?]
	at org.utbot.framework.process.EngineMainKt$setup$3.invoke(EngineMain.kt:94) ~[utbot-framework-2022.11.500..jar:?]
	at org.utbot.rd.CallsSynchronizer$measureExecutionForTermination$1$1.invoke(ClientProcessUtil.kt:84) ~[utbot-rd-2022.11.500..jar:?]
	at org.utbot.rd.CallsSynchronizer.measureExecutionForTermination(ClientProcessUtil.kt:75) ~[utbot-rd-2022.11.500..jar:?]
	at org.utbot.rd.CallsSynchronizer$measureExecutionForTermination$1.invoke(ClientProcessUtil.kt:83) ~[utbot-rd-2022.11.500..jar:?]
	at com.jetbrains.rd.framework.IRdEndpoint$set$1.invoke(TaskInterfaces.kt:182) ~[rd-framework-2022.3.1.jar:?]
	at com.jetbrains.rd.framework.IRdEndpoint$set$1.invoke(TaskInterfaces.kt:182) ~[rd-framework-2022.3.1.jar:?]
	at com.jetbrains.rd.framework.impl.RdCall.onWireReceived(RdTask.kt:360) ~[rd-framework-2022.3.1.jar:?]
	at com.jetbrains.rd.framework.MessageBroker$invoke$2$2.invoke(MessageBroker.kt:57) ~[rd-framework-2022.3.1.jar:?]
	at com.jetbrains.rd.framework.MessageBroker$invoke$2$2.invoke(MessageBroker.kt:56) ~[rd-framework-2022.3.1.jar:?]
	at com.jetbrains.rd.framework.impl.ProtocolContexts.readMessageContextAndInvoke(ProtocolContexts.kt:148) ~[rd-framework-2022.3.1.jar:?]
	at com.jetbrains.rd.framework.MessageBroker$invoke$2.invoke(MessageBroker.kt:56) ~[rd-framework-2022.3.1.jar:?]
	at com.jetbrains.rd.framework.MessageBroker$invoke$2.invoke(MessageBroker.kt:54) ~[rd-framework-2022.3.1.jar:?]
	at com.jetbrains.rd.util.threading.SingleThreadSchedulerBase.queue$lambda-3(SingleThreadScheduler.kt:41) ~[rd-core-2022.3.1.jar:?]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) [?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) [?:?]
	at java.lang.Thread.run(Thread.java:833) [?:?]

-837836269738182490-0.log

Environment

WIndows 10 Pro
IntelliJ IDEA 2022.2.3
IntelliJ project
JDK 17 (not reproducing on JDK 11)

Additional context

Not reproducing in UTBotJava project with JDK 11
Not reproducing with Fuzzing only mode or Symbolic only mode.
No exceptions present in Concrete executor log.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions