Paper: View Distance API causes chunks un-unloadable

Created on 10 Dec 2016  路  8Comments  路  Source: PaperMC/Paper

Incompatibility (Bug)

The use of player#setViewDistance(radius) is broken:

The plugin will remain loaded, and un-unloadable if:

  1. A player has an initial view distance of x
  2. player#setViewDistance(y) where y < x
  3. Player get offline or teleport away immediately or shortly after.

I have visualized un-unloadable chunks using this picture, white part means chunk is loaded. Those chunks cannot be unloaded using chunk#unload() either. http://i.imgur.com/lIamv7J.png

Plugin list:

Nothing except that testing plugin.

Reproduce:

As described above, set a higher initial view distance x, use player#setViewDistance(y) where y < x, then teleport around or get offline/online. This does not happen anytime to me, and the issue is more likely to happen when the map is newly generated.

Paper build number:

Paper 958, however this issue should be here since a long time ago.

inactive needs testing unsupported bug

Most helpful comment

Here is my way of testing and visualizing this issue. I wrote a plugin UnloadTest: https://www.dropbox.com/s/188id5cd6kxhtym/UnloadTest.jar?dl=0

This plugin has 2 features:

  1. /unloadtest unload, this will unload all chunk, in an non-forcible way. It iterates all chunk in your world and call Chunk#unload() on them, which is a safe way to unload.
  2. /unloadtest dump, this will create an image (example) that shows which chunk on the world is loaded. Each pixel indicates a chunk. In the example image, the hallowed squares are chunks not unloaded properly. The non-hallowed squares representing a player at that place (which causes chunks to be loaded).
    The image will be named as a current timestamp and will be found at plugins/UnloadTest. If the folder is not showing up, try create the directory maually.

All 8 comments

Likely a side-effect of patch 0170.

If its still less than the servers view distance, I would assume this is prob why.

On my server, all players have dynamic view distance. In case server lags for whatever reason (a lot of people get online), the view distance will drop. The drop of view distance will cause the bigger issue which described above. I also updated the issue for some reproducing instructions.
Happened today: http://i.imgur.com/3azpXhT.png

You could reduce the server view distance to 1 and make your system go higher than that when performing well.

@AlfieC This issue happens when "server not performing well"... Which is only decrease in view distance will trigger the issue.

Here is my way of testing and visualizing this issue. I wrote a plugin UnloadTest: https://www.dropbox.com/s/188id5cd6kxhtym/UnloadTest.jar?dl=0

This plugin has 2 features:

  1. /unloadtest unload, this will unload all chunk, in an non-forcible way. It iterates all chunk in your world and call Chunk#unload() on them, which is a safe way to unload.
  2. /unloadtest dump, this will create an image (example) that shows which chunk on the world is loaded. Each pixel indicates a chunk. In the example image, the hallowed squares are chunks not unloaded properly. The non-hallowed squares representing a player at that place (which causes chunks to be loaded).
    The image will be named as a current timestamp and will be found at plugins/UnloadTest. If the folder is not showing up, try create the directory maually.

Thank you for all the detail and testing materials provided, we appreciate it.

This method has been removed in the later versions, and therefore this issue isn't exactly reproducible.

Was this page helpful?
0 / 5 - 0 ratings