PrismarineJS / PrismarineJS/node-minecraft-protocol
Client connection times out when packet over 2097152 bytes (2mb) is sent to client
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 1.4k
- Forks
- 290
- Avg merge
- 4d 8h
- Merged PRs (30d)
- 7
Description
In vanilla Minecraft, if a packet over roughly 2mb is sent to the client it will throw the following exception

When a large packet like this is sent to a minecraft-protocol client, the client times out and fails to decompress and/or parse the packet. This can be proven by modifying the /src/transforms/compressor.js file at line 69 to the following:
if(value < 2097152 - 90000){
this.push(newBuf)
}
This will only parse the packet if its size is under 2mb. Upon implementing this patch, the client will successfully connect or remain connected to the server.
I can usually run minecraft-protocol easily on my system, but when an oversized packet is sent like this my computer begins slowing down and the fan begins to whir loudly, leading me to believe the process is allocating too much processing power to decompressing this packet. Below is the full error when the connection times out. The raw bytes logged in console right before the timeout is a map_chunk packet with too much NBT data.

I don't think the client should attempt to modify or repair these oversized packets, as that would cause client/server desync. If the client can parse it correctly, I see that as a successful fix.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by inspecting src/transforms/compressor.js around line 69 and reproduce the oversized map_chunk packet described in the issue. Trace decompression and parsing for packets over 2097152 bytes; done means the client parses the packet correctly without timing out or falling out of sync.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100