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

Space Engineers: Timeout for packet id 1 #21

Open
HimoriTempest opened this issue May 11, 2022 · 1 comment
Open

Space Engineers: Timeout for packet id 1 #21

HimoriTempest opened this issue May 11, 2022 · 1 comment

Comments

@HimoriTempest
Copy link

I can't directly point at what is causing it besides the fact that it always happens when a command opens a dialogue on the server.
Here is the plugin used to create a rcon server:
https://github.com/Jimmacle/torch-rcon-plugin

Full error message:
"error": { "message": "Timeout for packet id 1", "stack": "Error: Timeout for packet id 1\n at Timeout._onTimeout (/opt/node_modules/rcon-client/lib/rcon.js:117:28)\n at listOnTimeout (internal/timers.js:557:17)\n at processTimers (internal/timers.js:500:7)" }

@ssube
Copy link

ssube commented Dec 15, 2022

I am seeing the same error with a Conan Exiles server, pretty reliably, and may have made some progress:

The error appears to be in the packet ID, which are used in handlePacket to identify the promise to resolve (if I'm reading the function right): https://github.com/janispritzkau/rcon-client/blob/master/src/rcon.ts#L187

My first test was to add a log statement and see if packets were being received at all, which they were:

    handlePacket(data) {
        const packet = packet_1.decodePacket(data);
        const id = this.authenticated ? packet.id : this.requestId - 1;
        console.log('handle packet', id, packet);

Would consistently log something like:

handle packet 0 {
  id: 0,
  type: 2,
  payload: <Buffer ...>
}
[2022-12-15T14:40:54.967Z]  INFO: conan-discord/2362421 on ssube-hx90: logged in and ready (user=gluebot#9846)
[2022-12-15T14:41:01.429Z] DEBUG: conan-discord/2362421 on ssube-hx90: message created (user=ssube#1092, text=conan-online)
[2022-12-15T14:41:01.429Z] DEBUG: conan-discord/2362421 on ssube-hx90: message matched command (command=conan-online)
handle packet 1 {
  id: 0,
  type: 2,
  payload: <Buffer 49 64 ... many more bytes>
}

I'm not super familiar with the RCON protocol, but those show packet 0 with id: 0 and then packet 1 with another id: 0. I suspect the game server may be ignoring/repeating packet IDs, and confusing the client.

To verify that, I tried fudging the ID in handlePacket to be:

    handlePacket(data) {
        const packet = packet_1.decodePacket(data);
        const id = this.authenticated ? (packet.id + 1) : this.requestId - 1; // note packet.id + 1
        console.log('handle packet', id, packet);

I even checked the AST parse just in case and it should parse as this.authenticated ? (packet.id + 1) : (this.requestId - 1);, so I'm not sure why the packet numbers are off, other than the game server using its own system.

With the packet.id + 1 fix, I'm not seeing any timeouts.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants