Describe the bug
When you are using PacketEvents on servers below version 1.19.4, or even on newer versions that do not use Paper as a base, and the server has compression disabled, PacketEvents keeps searching for the compressor in the pipeline for every packet sent to the player. This causes GC pressure (since Netty internally creates a new list every time you call ChannelPipeline#names), and high CPU usage on servers with a high packet rate.
Software brand
git-PaperSpigot-445 (MC: 1.8.8)
Plugins
packetevents
How To Reproduce
1 - Create a 1.8.8 server.
2 - Add a debug statement on this line:
|
if (compressIndex == -1) return false; |
3 - Put PacketEvents with the debug into the
plugins folder.
4 - Change the
network-compression-threshold option to
-1.
5 - Join the server and observe that the debug is constantly triggered because
compress will never be found by PacketEvents.
Expected behavior
Only handle compression if, and after, the server sends the SET_COMPRESSION packet to the player.
Screenshots
Additional context
I haven’t tested it, but probably Sponge suffers from the same issue, since it’s the same code.
Describe the bug
When you are using PacketEvents on servers below version 1.19.4, or even on newer versions that do not use Paper as a base, and the server has compression disabled, PacketEvents keeps searching for the compressor in the pipeline for every packet sent to the player. This causes GC pressure (since Netty internally creates a new list every time you call
ChannelPipeline#names), and high CPU usage on servers with a high packet rate.Software brand
git-PaperSpigot-445 (MC: 1.8.8)
Plugins
packetevents
How To Reproduce
1 - Create a 1.8.8 server.
2 - Add a debug statement on this line:
packetevents/spigot/src/main/java/io/github/retrooper/packetevents/injector/handlers/PacketEventsEncoder.java
Line 241 in 1b0a8bf
3 - Put PacketEvents with the debug into the
pluginsfolder.4 - Change the
network-compression-thresholdoption to-1.5 - Join the server and observe that the debug is constantly triggered because
compresswill never be found by PacketEvents.Expected behavior
Only handle compression if, and after, the server sends the SET_COMPRESSION packet to the player.
Screenshots
Additional context
I haven’t tested it, but probably Sponge suffers from the same issue, since it’s the same code.