aws-minecraft-proxy icon indicating copy to clipboard operation
aws-minecraft-proxy copied to clipboard

Player Kicked with Disconnected error

Open ghost opened this issue 5 years ago • 3 comments

Once the server has booted up and the player rejoins, the player is kicked after ~30 seconds and shown a disconnected message. This happens consistently every time. I am running a MC 1.17.1 paperMC server. After increasing the log level I noticed that the player is kicked after a emit message saying "login timeout" I therefore updated the minecraft-protocol dependency to 1.25 to try to fix the issue but that didn't work

After some trial and error I found a temporary fix by adding the kickTimeout parameter to the createServer function. The user is always kicked when this timeout ends therefore I have just set the timeout to 100000000 to prevent the issue.

/src/index.js Line 56 const server = new Server(25565, config.target.host, config.target.port, {kickTimeout: 100000000});

ghost avatar Aug 13 '21 13:08 ghost

Interesting. I'm most surprised that this seems to be new (at least I didn't experience it back when I used the project).

I've since deleted my AWS setup, so it'll take a bit of time for me to manually debug this. If possible, could you check if adding client.framer.unpipe() after this line helps? This should stop minecraft-protocol from writing to the stream all together.

diff --git a/src/server.js b/src/server.js
index 1fb419e..c1e00ed 100644
--- a/src/server.js
+++ b/src/server.js
@@ -106,6 +106,7 @@ export default class ProxyServer extends EventEmitter {
                 socket = client.socket;
                 client.socket = createNoopStream();
                 socket.unpipe(); // stop everyone else from listening to it
+                client.framer.unpipe(); // stop minecraft-protocol client from writing to it
                 socket.pipe(targetConnection);
                 targetConnection.pipe(socket);
             } catch (err) {

(run systemctl restart minecraft-proxy to restart the server afterwards, if you're running the proxy as a .service)

birjj avatar Aug 13 '21 16:08 birjj

I tried the fix and it works great the proxy runs very stable and doesn't kick anyone out (tested for about 4h).

tecbeat avatar May 11 '22 06:05 tecbeat

@SamuelMichaAssmann Thanks for testing! I updated the code, so hopefully this issue should be fixed in version 2.0.1 and onwards.

birjj avatar May 11 '22 15:05 birjj