lucko / spark

A performance profiler for Minecraft clients, servers, and proxies.
https://spark.lucko.me/
GNU General Public License v3.0
1.02k stars 139 forks source link

JVM Segfault when running with JBR #426

Open radstevee opened 1 month ago

radstevee commented 1 month ago

Description

The JVM segfaults either on server initialisation or once starting the profiler. Only happens when running the server with the Jetbrains Runtime. When using something like Adoptium, it works just fine.

Reproduction Steps

Use this gradle build file:

plugins {
    java
    id("xyz.jpenilla.run-paper") version "2.3.0"
}

group = "net.radstevee"
version = "1.0-SNAPSHOT"

repositories {
    mavenCentral()
    maven("https://repo.papermc.io/repository/maven-public/")
}

dependencies {
    compileOnly("io.papermc.paper:paper-api:1.21-R0.1-SNAPSHOT")
}

tasks.runServer {
    minecraftVersion("1.21")
}

tasks.withType<xyz.jpenilla.runtask.task.AbstractRun> {
    javaLauncher =
        javaToolchains.launcherFor {
            vendor = JvmVendorSpec.JETBRAINS // Works when commenting out
            languageVersion = JavaLanguageVersion.of(21)
        }
    jvmArgs("-XX:+AllowEnhancedClassRedefinition", "-XX:+AllowRedefinitionToAddDeleteMethods") // Works when commenting out
}

Expected Behaviour

The spark profiler should start just fine.

Platform Information

Spark Version

v1.10.83

Logs and Configs

https://pastes.dev/LuQuORkAud <- JVM Error log

https://pastes.dev/IpOHvQ3wmz <- Server log

Extra Details

No response

SirYwell commented 1 month ago

That seems to be a bug in JBR. The InstanceKlass::methods() array is larger than the InstanceKlass::method_ordering() array.