aridevelopment-de / fabric-packet-logger

Client-side packet logger with web-ui
https://modrinth.com/mod/packetlogger
GNU Affero General Public License v3.0
21 stars 6 forks source link

Second Minecraft client crashes when a first one has already been launched #28

Open janoschpch opened 1 year ago

janoschpch commented 1 year ago

When a second minecraft client with fabric packet logger installed is being started it just crashes. Reason for this is that fabric packet logger binds to a port for the webinterface and when its already being used by the first client it just crashes. This issue is could also be important for compatibility of other software that runs on the port(s) used by fabric packet logger. Maybe just a automatic change of the port or a simple error message "Fabric Logger couldn't start because of..." would be nice in my opinion.

Thats the full error from my client (if it's not already clear):


java.lang.RuntimeException: Could not execute entrypoint stage 'main' due to errors, provided by 'packetlogger'!
    at net.fabricmc.loader.impl.entrypoint.EntrypointUtils.lambda$invoke0$0(EntrypointUtils.java:51)
    at net.fabricmc.loader.impl.util.ExceptionUtil.gatherExceptions(ExceptionUtil.java:33)
    at net.fabricmc.loader.impl.entrypoint.EntrypointUtils.invoke0(EntrypointUtils.java:49)
    at net.fabricmc.loader.impl.entrypoint.EntrypointUtils.invoke(EntrypointUtils.java:35)
    at net.fabricmc.loader.impl.game.minecraft.Hooks.startClient(Hooks.java:52)
    at net.minecraft.class_310.<init>(class_310.java:468)
    at net.minecraft.client.main.Main.main(Main.java:198)
    at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:468)
    at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74)
    at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23)
    at org.prismlauncher.launcher.impl.StandardLauncher.launch(StandardLauncher.java:88)
    at org.prismlauncher.EntryPoint.listen(EntryPoint.java:126)
    at org.prismlauncher.EntryPoint.main(EntryPoint.java:71)
Caused by: java.lang.RuntimeException: java.net.BindException: Address already in use
    at de.ari24.packetlogger.PacketLogger.onInitialize(PacketLogger.java:42)
    at net.fabricmc.loader.impl.entrypoint.EntrypointUtils.invoke0(EntrypointUtils.java:47)
    ... 10 more
Caused by: java.net.BindException: Address already in use
    at java.base/sun.nio.ch.Net.bind0(Native Method)
    at java.base/sun.nio.ch.Net.bind(Net.java:555)
    at java.base/sun.nio.ch.ServerSocketChannelImpl.netBind(ServerSocketChannelImpl.java:337)
    at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:294)
    at java.base/sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:89)
    at jdk.httpserver/sun.net.httpserver.ServerImpl.<init>(ServerImpl.java:101)
    at jdk.httpserver/sun.net.httpserver.HttpServerImpl.<init>(HttpServerImpl.java:50)
    at jdk.httpserver/sun.net.httpserver.DefaultHttpServerProvider.createHttpServer(DefaultHttpServerProvider.java:35)
    at jdk.httpserver/com.sun.net.httpserver.HttpServer.create(HttpServer.java:150)
    at de.ari24.packetlogger.web.HTTPServer.start(HTTPServer.java:21)
    at de.ari24.packetlogger.PacketLogger.onInitialize(PacketLogger.java:40)
    ... 11 more```
Ari24-cb24 commented 1 year ago

Weird that packetlogger crashes, it just shouldn't start the webserver at all. For now, try to change the port in the packetlogger config (via modmenu) of your first instance