Instead of allocating a buffer for every chunk compression, reuse
the same 64k sized buffer.
Also stopped doing dynamic compression levels. It wasn't helping enough.
This will improve memory usage and zlib performance of chunk compression.
plugins that threw an error could get timings thrown off in its state
this likely led to inconsistent and unexplainable data in timings reports.
this ensures that exceptions will still stopTiming and let the system
auto self recover from corrupt stacks too.
As per 1.13, we have no evidence these illegal states are causing
issues we can identify, so just going to hide the fact its happening
(but still have the code to auto fix it)
Mojang stored whitelist state in 2 places (Whitelist Object, PlayerList)
some things checked PlayerList, some checked object. This moves
everything to the Whitelist object.
Also adds a limit to stop sending Sign data to client after 500
signs per chunk to limit client lag.
Use -DPaper.excessiveSignsLimit=500 to configure that limit, or -1
to disable the limit and let your players be abused.
fixes#1878
now 80 chars counts multi sized code points the same so 80 chinese
characters would be allowed too.
Removed outbound limit as it doesn't solve the chunk oversize problem.
proper fix for chunk sending in another patch next.
modified clients can send abnormally large data from the client
to the server and it would get stored on the sign as sent.
the client can barely render around 16 characters as-is, but formatting
codes can get it to be more than 16 actual length.
Set a limit of 80 which should give an average of 16 characters 2
sets of legacy formatting codes which should be plenty for all uses.
This does not strip any existing data from the NBT as plugins
may use this for storing data out of the rendered area.
it only impacts data sent to and from the client.
Set -DPaper.maxSignLength=XX to change limit or -1 to disable
Also fix sign edit memory leak
ConcurrentHashMap synchronizes on .computeIfAbsent even on hits,
so this does a .get(key) first, which most of our use should
be hits, and then falls back to the CHM computeIfAbsent for thread safe puts.
Also improve concurrency on handler and group collections to use a synchronized
list instead of an array deque for concurrency safety.
This brings in Spigots Oversized Chunks fix so that servers migrating from
Spigot 1.12 to Paper 1.12 can safely transition the save formats.
Spigot Changes:
79a30d7d Allow Saving Large Chunks
Please test this build on a local TEST SERVER before sending to your live server!
PaperMC is not responsible for any data loss to your chunks.
-------------------------------------------------------------------
The Minecraft World Region File format has a hard cap of 1MB per chunk.
This is due to the fact that the header of the file format only allocates
a single byte for sector count, meaning a maximum of 256 sectors, at 4k per sector.
This limit can be reached fairly easily with books, resulting in the chunk being unable
to save to the world. Worse off, is that nothing printed when this occured, and silently
performed a chunk rollback on next load.
This leads to security risk with duplication and is being actively exploited.
This patch catches the too large scenario, falls back and moves any large Entity
or Tile Entity into a new compound, and this compound is saved into a different file.
On Chunk Load, we check for oversized status, and if so, we load the extra file and
merge the Entities and Tile Entities from the oversized chunk back into the level to
then be loaded as normal.
Once a chunk is returned back to normal size, the oversized flag will clear, and no
extra data file will exist.
This fix maintains compatability with all existing Anvil Region Format tools as it
does not alter the save format. They will just not know about the extra entities.
This fix also maintains compatability if someone switches server jars to one without
this fix, as the data will remain in the oversized file. Once the server returns
to a jar with this fix, the data will be restored.
This change closes the plugin via the plugin manager, which disables
the plugin, as intended, but also cleans up after the plugin, preventing
any further errors or issues caused by tasks scheduled by the plugin before
it failed.
Backport of 1.13 cf772531f4
The base64 encoding method for server favicons in 1.12 puts newlines in
the encoded string. The 1.13 client and server pair fixed this issue and
no longer consider it valid. Luckily the 1.12.2 client will parse the
correct encoding just fine as well.
This fixes the encoding so that the server icon will display properly on
both 1.12.2 clients as well as newer clients.
Shout out to ViaVersion whose contributors noticed this some time ago.
If the server attempts to load a chunk generated by a newer version of
the game, immediately stop the server to prevent data corruption.
You can override this functionality at your own peril.