PaperMC / PaperMC/Velocity

Player's game (1.16.5) crashes when attempting to .fireAndForget()

Open
#859 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type: bug
Dominant language
Java
Stars
2.3k
Forks
959
Avg merge
5d 10h
Merged PRs (30d)
2

Description

Capture PNG

Greetings,
I've run into an exception and I might be wrong but I think this is a legitimate issue.
Velocity server version: 3.1.2-SNAPSHOT build 179
Proxy server is running online-mode.
Backend servers are not (ofc).
Am using modern player-info-forwarding-mode.
The Paper sub-server is running Paper 1.16.5. Build 794

What is happening?
When I issue a .fireAndForget() request. The player makes it to the Joining World... screen. But shortly after; the screen changes to Saving World... at which case my game (Minecraft Java 1.16.5) freezes and crashes. The error that popups in the Minecraft client links to here: https://bugs.mojang.com/browse/MC-23484

What do I think is causing it?
Unfortunately, the exception didn't give me much info. Additionally, I'm not very knowledgeable in how Minecraft connections work (hence why I wanted to use .fireAndForget().)
But I looked in https://github.com/PaperMC/Velocity/blob/6547ccaa7e631ba0a77ff6dd0bf679c1bf960327/proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java
And noticed how .connectWithIndication() which is basically the real name of .fireAndForget() says // TODO: The exception handling from this is not very good. Find a better way.
Fair enough. However, even if the exception was handled properly, it's still an exception. Which means that something must be going wrong!
Do we have any knowledge of a known error inside of this general area of code?
I will note. That the RegisteredServer that I'm using .connectWithIndication() on; has been registered by my own plugin and not via the Velocity config. However, I doubt this would cause any issues considering the connection is going through (I see the player join message on the Paper server that I'm trying to join into. It's just that my game freezes and then crashes.)
Is it possible that maybe some sort of connection "finalization" packet isn't getting sent which just causes the Minecraft client to just sit and wait for something to happen?

What have I tried?
Honestly nothing. I seriously am not super knowledgeable in the Minecraft connection world.
I found the issue yesterday and was working on finding the code for the method so I could see if there was anything obvious I should check out.
I think I'm going to try copying some of the connection code from the repository and see if I'm able to get an Exception that actually explains more about what is happening.

I also have not tried implementing what I need using .connect() that will probably be the first thing I try after writing this. But even if .connect() works, that doesn't change that for some reason .connectWithIndication() is not.

Also my actual code block I'm using to connect:

player.createConnectionRequest(server.getRawServer()).fireAndForget();
// OR
player.createConnectionRequest(server.getRawServer()).connectWithIndication();

.getRawServer() is returning a RegisteredServer.

Finishing up

Hopefully, this has been enough information to give you an idea of the issue! Generally speaking, I don't really open Issues. But the thing that convinced me to do so was how my client was completely crashing as a result of whatever the Exception is. Even if something I setup wasn't totally correct, it shouldn't result in someone's client crashing. At least I don't think so :)
Hopefully, we can find a resolution to this issue! If I find anything I'll post an update!

(Screenshot taken from my Velocity server's console)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in proxy/src/main/java/com/velocitypowered/proxy/connection/client/ConnectedPlayer.java, focusing on connectWithIndication(), which fireAndForget() invokes. Reproduce the reported connection with Paper 1.16.5 and inspect the exception and console output around that path, then compare it with connect(). Done means the cause of the client crash is identified and the connection path has a verified fix or a clear, actionable diagnosis.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.