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

(Relay) Unable to join select realms or servers #474

Open
JSbETms opened this issue Jan 17, 2024 · 19 comments
Open

(Relay) Unable to join select realms or servers #474

JSbETms opened this issue Jan 17, 2024 · 19 comments
Labels
awaiting info Waiting for op/more details

Comments

@JSbETms
Copy link

JSbETms commented Jan 17, 2024

When attempting to join any realm with relay the client is kicked with "Server sent broken packet"
image
The code I used is the same as the one supplied in API.md.
This is not because I am banned on said realm(s) as the regular client works fine.

@extremeheat
Copy link
Member

Only on Realms? Not on a vanilla server? Can you provide the debug logs (see README.md)? And make sure to set logging: true in the client options.

@JSbETms
Copy link
Author

JSbETms commented Jan 20, 2024

Both on realms and vanilla servers.
Here is the console output with debug and logging enabled Console Output.

@JSbETms JSbETms changed the title (Relay) Unable to join realms (Relay) Unable to join realms or servers Jan 20, 2024
@extremeheat
Copy link
Member

Ok, will look into it. Do you know if this started with 1.20.50 or does it happen on 1.20.40 also?

@extremeheat
Copy link
Member

Can't reproduce, on client 1.20.51. Check your dependencies with npm update and your code.

image

@JSbETms
Copy link
Author

JSbETms commented Jan 21, 2024

After having a better look at it, it only seems to disconnect with specific realms/servers (Similar to what happened with #426).
Here is the amended code I have used:

const { Relay } = require('bedrock-protocol')
const relay = new Relay({
  host:'0.0.0.0',
  port:19132,
  destination:{realms:{realmInvite:'code'}}
})
relay.listen()
relay.on('connect', player => {
  console.log('New connection', player.connection.address)
})

@JSbETms JSbETms changed the title (Relay) Unable to join realms or servers (Relay) Unable to join select realms or servers Jan 21, 2024
@extremeheat
Copy link
Member

You're going to need to provide more specifics on how to reproduce (ie what servers) or there is no path to resolution here.

The log file you provided shows the server disconnecting you without sending any disconnect packet, just closing the connection. That could be anything, so can't extract any meaningful information from that.

@extremeheat extremeheat added the awaiting info Waiting for op/more details label Jan 22, 2024
@JSbETms
Copy link
Author

JSbETms commented Jan 22, 2024

Sorry for being vague. I'm not certain but I believe it may be related to scoreboards or enums.

@extremeheat
Copy link
Member

Can you elaborate?

@JSbETms
Copy link
Author

JSbETms commented Jan 24, 2024

The client is only kicked when a scoreboard is present on the realm/server so I think it could be related to packets concerning scoreboards (Like update_soft_enum)

@extremeheat
Copy link
Member

Can you show something to explain more on that? Where in the server<->client communications do you see things related to scoreboards? Your only log file shows you being disconnected before spawning.

@JSbETms
Copy link
Author

JSbETms commented Feb 1, 2024

Only on Realms? Not on a vanilla server? Can you provide the debug logs (see README.md)? And make sure to set logging: true in the client options.

Is there a way for logging to send the output directly to a file instead of the console? I would be able to give a more detailed log as my console would not fill up.

@JSbETms
Copy link
Author

JSbETms commented Feb 10, 2024

Apologies, here is a more detailed Log.

@extremeheat
Copy link
Member

You'll need to provide some steps to reproduce otherwise nothing can be done here. The log file doesn't contain anything out of the ordinary, the server is just choosing to close the connection without sending a disconnect packet. That could be anything, bad network connection, server crashing/erroring, etc.

@ATripple
Copy link

image
It's a crasher..

@JSbETms
Copy link
Author

JSbETms commented Mar 9, 2024

It's a crasher..

The client is kicked under certain conditions, also when players are not online, on a private server/realm.

@Cdm2883
Copy link

Cdm2883 commented Mar 23, 2024

I'm also bothered by this question.

So far I've found 2 servers that cause Relay to crash with "Server sent broken packet".

One of them crashes immediately after loading the resource pack before rendering the world.

The other one can enter the game's rendered world, but will crash at an unknown point shortly after.

The console output on crash is the same as this.

Both on realms and vanilla servers. Here is the console output with debug and logging enabled Console Output.

This console output seems to only tell that it crashed, not what it went through before it crashed.

It's also interesting to note that if you don't use relay and use bedrock.createClient() or new Client(), you won't have this error sent.

Can I give any additional information to help with this?

@JSbETms
Copy link
Author

JSbETms commented Apr 2, 2024

After experimenting around I think this issue may be related to custom/additional items, such as having education features enabled, experimental features (such as the “1.21” upcoming features toggle), or use of an external behaviour pack.

@Cdm2883
Copy link

Cdm2883 commented May 3, 2024

Sorry about my poor English <3

Okay, I seem to have found out what the problem is.
It's that the crafting_data packet has an old definition somewhere, and the issue may have to be transferred to the minecraft-data.

I have a temporary solution until fixing the definition, I can try to make the crafting_data packet be forwarded to the client without processing. Here's how to do it:

Add a line of code to src/relay.js#L62 with the following line: if (name === 'crafting_data') return

If you want to make the changes before fixing it, but the package still retains the changes when it is updated, you can try the patch-package npm package.

(Hopefully bedrock-protocol will add a few configuration options so that packages that can't be parsed or custom excluded are forwarded directly to the client as-is, maybe I'll make a pr for that later?)

@extremeheat
Copy link
Member

All packets should of course be parsed correctly, otherwise the purpose of the Relay to view/inspect/modify does not work. The behavior there should be the same as vanilla, for invalid packets we definitely want to throw where the client would not normally accept. If there is an issue with the crafting data packet then we should likely fix.

Re-enabling the debug option to check for encode/decode correctness seems like a good idea.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting info Waiting for op/more details
Projects
None yet
Development

No branches or pull requests

4 participants