Skip to content

IllegalStateException for the Unsafe.putAddress usage leading to JVM crash example - for JDK 11 #721

Closed
@alisevych

Description

@alisevych

Description

Code sample contains Unsafe.putAddress method call that leads to JVM crash in project with JDK 11.
When mocks are on - IllegalStateException in Concrete Executor is thrown.

To Reproduce

Steps to reproduce the behavior:

  1. Run IntelliJ IDEA 2022.1.4 with UTBot installed - from denis-fokin\gradle_version_upgrade
  2. Create a project with JDK 11.
  3. Copy org/utbot/examples/exceptions/JvmCrashExamples.java from UTBotJava project, utbot-sample

Expected behavior

Tests on JVM crash are supposed to be generated.
No Concrete Execution errors are expected.

Actual behavior

Concrete Execution errors thrown

Visual proofs (screenshots, logs, images)

The following test class is generated - with plugin from denis-fokin\gradle_version_upgrade

package org.utbot.examples.exceptions;

import org.testng.annotations.Test;

public class GradleUpgradeJvmCrashExamplesTest {
    ///region Test suites for executable org.utbot.examples.exceptions.JvmCrashExamples.crash

    ///region

    /**
     * <a href="file:///C:/Users/LWX118~1/AppData/Local/Temp//hs_err_pid6316.log">JVM crash report</a>
     */
    @Test(enabled = false, description = "Disabled due to possible JVM crash")
    public void testCrash1() throws Exception {
        JvmCrashExamples jvmCrashExamples = new JvmCrashExamples();

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

    ///region Errors report for crash

    public void testCrash_errors() {
        // Couldn't generate some tests. List of errors:
        // 
        // 208 occurrences of:
        // Concrete execution failed

        // 18 occurrences of:
        /* class soot.jimple.StaticFieldRef cannot be cast to class soot.jimple.internal.JimpleLocal (soot.jimple.StaticFieldRef and
        soot.jimple.internal.JimpleLocal are in unnamed module of loader com.intellij.ide.plugins.cl.PluginClassLoader @8d8b598) */

    }
    ///endregion

    ///endregion

}

Gradle upgrade branch with JDK 11.log

Unsafe - from main on JDK 11.log

Environment

Windows 10 Pro
IntelliJ IDEA 2022.1.4
Maven project with JDK 11

Additional context

Concrete Execution errors are thrown with plugin published from main branch
But from main - there is no test generated, the test class is empty.

Metadata

Metadata

Assignees

Labels

ctg-bugIssue is a bug

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions