mojira.dev
MC-307177

Enabling JFR profiling causes the client to crash on startup

Setting the --jfrProfile option causes the game to immediately crash while attempting to start JFR.

Since the crash happens before the game version is set, the crash report handler also crashes, obscuring the original stack trace and exception, and providing no crash report. This also leads to the only text in the console being the exception message and stacktrace.

Using a debugger to set the game version and print the crash report shows that the cause to the crash is also the game version not being set.

Looking at the code for the client.Main class it can be seen that SharedConstants.tryDetectVersion(); is only ran significantly after JFR is attempted to be started. The game client is the only class that has this behavior, with all other Main having SharedConstants.tryDetectVersion(); as their first line.

Steps to reproduce:

  • Start a Minecraft client with --jfrProfile

  • Game crashes, with only stacktrace pointing to the crash report handler as the output


Stacktrace:

Exception in thread "main" java.lang.IllegalStateException: Game version not set
	at net.minecraft.SharedConstants.getCurrentVersion(SharedConstants.java:253)
	at net.minecraft.SystemReport.<init>(SystemReport.java:40)
	at net.minecraft.CrashReport.<init>(CrashReport.java:35)
	at net.minecraft.CrashReport.forThrowable(CrashReport.java:225)
	at net.minecraft.client.main.Main.main(Main.java:202)

The crash report obtained with the use of the debugger is attached

Attachments

Comments 1

Thank you for helping us improve Minecraft! We saved your files:

[media]

Awakened Redstone

(Unassigned)

Unconfirmed

(Unassigned)

26.1.1

Retrieved