gekware / minecraft-server-hibernation

Autostart and stop minecraft-server when players join/leave
GNU General Public License v3.0
379 stars 37 forks source link

Timeout at login #228

Open EinGlasVollKakao opened 1 year ago

EinGlasVollKakao commented 1 year ago

Current Behavior (🐛 Bug)

Hello.

I'm running a Forge server with roughly 200 mods. I ran an old version of msh (v2.4.9) and finally decided to update to the newest version today. But after that i couldn't connect to the server. The client displayed Loading terrain... but instead of joining it just disconnected after some time.

In the msh logs this line caught my attention:

2023/05/09 23:40:48.263 [warn  ≡   ] forwardTCP: closing      10.0.2.131 -->       127.0.0.1 | client --> server (cause: read tcp 10.0.42.77:25565->10.0.2.131:54754: i/o timeout) [02f104]

So it seems the server closes the connection (hence why no error at the client) because of some timeout.

After digging a little bit in the code, i found this: https://github.com/gekware/minecraft-server-hibernation/blob/0876091137acf249c64d6a84538e42783cc87c9f/lib/conn/conn.go#LL232C1-L232C1

So after changing this timeout from 10 seconds to one minute (just for testing, I don't know which time would be enough), i could login.

Now I'm not really sure if this is just a problem I was facing, but I thought I'd share it with you. This timeout could be set in the configuration, so that it is easily changeable if it takes too long when joining.

Expected Behavior

Don't disconnect a player while he's joining.

Steps to Reproduce

I would guess this happens when you have many mods installed and it takes long to join a world.

MSH Logs

No response

MSH-Version

2.5.0

MSH-Commit

0876091

Operating system

Arch-Linux kernel: 6.2.13

System architecture?

AMD64

Minecraft Version

1.18.2

Minecraft Server Software?

Forge

Is there an existing issue for this?

TheDevMinerTV commented 1 year ago

I have the same issue with Chroma Endless (also a Forge modpack, though 1.16.5).

Setting the read and write deadline to time.Minute fixed it.

gekigek99 commented 11 months ago

@TheDevMinerTV where did you set the deadline?

can you make a PR? thanks

TheDevMinerTV commented 11 months ago

Done ✅