Pugmatt / BedrockConnect

Join any Minecraft Bedrock Edition server IP on Xbox One, Nintendo Switch, and PS4/PS5
GNU General Public License v3.0
1.41k stars 165 forks source link

Buffer inflation exception #357

Closed jarmond closed 4 months ago

jarmond commented 1 year ago

What happened?

Using Bedrock Connect 1.26, I'm getting an exception on connect:

bedrock-connect_1  | [Network Listener - #3] WARN io.netty.util.concurrent.AbstractEventExecutor - A task raised an exception. Task: com.pyratron.pugmatt.protocol.bedrock.BedrockRakNetSessionListener$$Lambda$155/0x0000000800f2f4c8@5404af01
bedrock-connect_1  | java.lang.RuntimeException: Unable to inflate buffer data
bedrock-connect_1  |    at com.pyratron.pugmatt.protocol.bedrock.wrapper.BedrockWrapperSerializerV9_10.deserialize(BedrockWrapperSerializerV9_10.java:87)
bedrock-connect_1  |    at com.pyratron.pugmatt.protocol.bedrock.BedrockSession.onWrappedPacket(BedrockSession.java:283)
bedrock-connect_1  |    at com.pyratron.pugmatt.protocol.bedrock.BedrockRakNetSessionListener.lambda$onEncapsulated$0(BedrockRakNetSessionListener.java:39)
bedrock-connect_1  |    at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
bedrock-connect_1  |    at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:469)
bedrock-connect_1  |    at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:387)
bedrock-connect_1  |    at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:986)
bedrock-connect_1  |    at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
bedrock-connect_1  |    at java.base/java.lang.Thread.run(Thread.java:833)
bedrock-connect_1  | Caused by: java.util.zip.DataFormatException: incorrect header check
bedrock-connect_1  |    at java.base/java.util.zip.Inflater.inflateBufferBuffer(Native Method)
bedrock-connect_1  |    at java.base/java.util.zip.Inflater.inflate(Inflater.java:546)
bedrock-connect_1  |    at com.nukkitx.natives.zlib.Java11Inflater.inflate(Java11Inflater.java:21)
bedrock-connect_1  |    at com.pyratron.pugmatt.protocol.util.Zlib.inflate(Zlib.java:56)
bedrock-connect_1  |    at com.pyratron.pugmatt.protocol.bedrock.wrapper.BedrockWrapperSerializerV9_10.deserialize(BedrockWrapperSerializerV9_10.java:61)
bedrock-connect_1  |    ... 8 more

Expected Behaviour?

Connection to serverlist.

Steps to reproduce.

No response

Screenshots/Videos

No response

Minecraft Bedrock Version

1.19.50

Console

Windows 11

Additional Context

No response

Pugmatt commented 1 year ago

Sorry for the delay. Did some tests on my end but can't seem to replicate. Do you have any startup arguments enabled (e.g. custom_servers, language, etc), or is it the default setup?

jarmond commented 1 year ago

Thanks for taking a look. I do have arguments:

java -jar BedrockConnect-1.0-SNAPSHOT.jar \
    nodb=true \
    custom_servers=custom-servers.json \
    whitelist=connect-whitelist.txt \
    featured_servers=false

Java is openjdk-17-jre-headless - OpenJDK 64-Bit Server VM (build 17.0.5+8-Ubuntu-2ubuntu120.04, mixed mode, sharing). I have two servers listed in custom-servers.json, with same IP but different ports, both have an iconUrl.

Pugmatt commented 1 year ago

Try changing your launch command to the following:

java -XX:+UnlockDiagnosticVMOptions -XX:-UseAESCTRIntrinsics -jar BedrockConnect-1.0-SNAPSHOT.jar \
    nodb=true \
    custom_servers=custom-servers.json \
    whitelist=connect-whitelist.txt \
    featured_servers=false

Not sure if this is the same issue, but the error looks to be coming from the Protocol library BedrockConnect uses, and it looks like there are similar error reports from Geyser's issue tracker, which also uses the same Protocol library: https://github.com/GeyserMC/Geyser/issues/2694 https://github.com/GeyserMC/Geyser/issues/2861

jarmond commented 1 year ago

Tried the additional java args, but it made no difference I'm afraid.

Camotoy commented 1 year ago

We've also seen this error for jars that aren't up-to-date with 1.19.30+ support.

jarmond commented 4 months ago

Yes, this is fixed in current versions.