Tnze / go-mc

Collection of Go libraries for Minecraft

Home Page:https://go-mc.github.io/tutorial/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Packet reading hangs and goes into infinite loop trying to read a packet

maxsupermanhd opened this issue · comments

Describe the bug
After updating to 1.19.4 (master) from 1.19.2 in certain condition bot hangs and infinitely reads same packet.

I have a discord bridge that has tab rendering:
https://github.com/maxsupermanhd/BlockBridge/tree/v762.0.0

Sometimes when I request a tab image from discord (/tab) it draws the tab perfectly fine but after that consumes 100% of one core and does not receive nor parse new packets and does not disconnect even if underlying connection is being killed by keepalive killer or closed by the server.

Additional context
It is not a race or threading issue, tested with -race and same result

commented

Do you know which loop is infinite? VarInt?

commented

There are some guides using gdb to debug infinity loops:

gdb a.out
info threads
thread thread_id
info frame

Yes, I know that HandleGame never exits, when adding debug logging it is being stuck at reading same packet again and again and again. It is trying to read chat.Message (the tab menu).

I sent more debugging information in Discord. It seems like it actually reads from connection same packet and underlying conn and fd thinks it is connected (it is not)

Ok, some very valuable information in my opinion:
image
When connection pull fails it fails without setting an error and it causes it to reuse same packet over and over again because it is never updated in the first place
@Tnze Not funny!