Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: fix server crash when executing console commands #5250

Merged
merged 1 commit into from
Jun 2, 2024

Conversation

BenjaminAmos
Copy link
Contributor

Contains

This pull request fixes the following crash when trying to run console commands against a server:

10:59:55.318 [main] ERROR o.t.engine.core.TerasologyEngine - Uncaught exception, attempting clean game shutdown
java.lang.IllegalAccessError: failed to access class org.terasology.engine.logic.console.CommandEvent from class org.terasology.engine.logic.console.ConsoleSystemMethodAccess (org.terasology.engine.logic.console.CommandEvent is in unnamed module of loader 'app'; org.terasology.engine.logic.console.ConsoleSystemMethodAccess is in unnamed module of loader com.esotericsoftware.reflectasm.AccessClassLoader @4b336cc8)
        at org.terasology.engine.logic.console.ConsoleSystemMethodAccess.invoke(Unknown Source)
        at org.terasology.engine.entitySystem.event.internal.EventSystemImpl$ByteCodeEventHandlerInfo.invoke(EventSystemImpl.java:399)
        at org.terasology.engine.entitySystem.event.internal.EventSystemImpl.sendStandardEvent(EventSystemImpl.java:264)
        at org.terasology.engine.entitySystem.event.internal.EventSystemImpl.send(EventSystemImpl.java:255)
        at org.terasology.engine.core.bootstrap.eventSystem.AbstractEventSystemDecorator.send(AbstractEventSystemDecorator.java:67)
        at org.terasology.engine.network.NetworkEventSystemDecorator.send(NetworkEventSystemDecorator.java:54)
        at org.terasology.engine.core.bootstrap.eventSystem.AbstractEventSystemDecorator.send(AbstractEventSystemDecorator.java:67)
        at org.terasology.engine.recording.RecordingEventSystemDecorator.send(RecordingEventSystemDecorator.java:32)
        at org.terasology.engine.entitySystem.entity.internal.BaseEntityRef.send(BaseEntityRef.java:188)
        at org.terasology.engine.network.internal.NetClient.processEvents(NetClient.java:526)
        at org.terasology.engine.network.internal.NetClient.processReceivedMessages(NetClient.java:420)
        at org.terasology.engine.network.internal.NetClient.update(NetClient.java:220)
        at org.terasology.engine.network.internal.NetworkSystemImpl.update(NetworkSystemImpl.java:341)
        at org.terasology.engine.core.subsystem.common.NetworkSubsystem.preUpdate(NetworkSubsystem.java:38)
        at org.terasology.engine.core.TerasologyEngine.tick(TerasologyEngine.java:506)
        at org.terasology.engine.core.TerasologyEngine.mainLoop(TerasologyEngine.java:473)
        at org.terasology.engine.core.TerasologyEngine.runMain(TerasologyEngine.java:449)
        at org.terasology.engine.core.TerasologyEngine.run(TerasologyEngine.java:415)
        at org.terasology.engine.Terasology.call(Terasology.java:189)
        at org.terasology.engine.Terasology.call(Terasology.java:69)
        at picocli.CommandLine.executeUserObject(CommandLine.java:1933)
        at picocli.CommandLine.access$1200(CommandLine.java:145)
        at picocli.CommandLine$RunLast.executeUserObjectOfLastSubcommandWithSameParent(CommandLine.java:2332)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2326)
        at picocli.CommandLine$RunLast.handle(CommandLine.java:2291)
        at picocli.CommandLine$AbstractParseResultHandler.execute(CommandLine.java:2159)
        at picocli.CommandLine.execute(CommandLine.java:2058)
        at org.terasology.engine.Terasology.main(Terasology.java:138)

The CommandEvent class was package-private, which seems unintentional since the entire org.terasology.engine.logic.console package is exported as an API package. This pull request fixes the crash by making it public.

How to test

  • Start a new server with gradlew server.
  • Run a client with gradlew game in a separate terminal (or from IntelliJ).
  • Join the server using the client (Main Menu->Join).
  • On the client, open the console with ` and run the setSpawnLocation command.
  • The server should not crash.

@github-actions github-actions bot added the Type: Bug Issues reporting and PRs fixing problems label Jun 2, 2024
@BenjaminAmos BenjaminAmos merged commit 9b498fa into develop Jun 2, 2024
14 of 15 checks passed
@BenjaminAmos BenjaminAmos deleted the fix/server-console-crash branch June 2, 2024 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issues reporting and PRs fixing problems
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants