Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-3464

Chunks are not unloaded if world.setAutoSave(true) was set

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Invalid
    • Icon: Major Major
    • None
    • None
    • A freshly installed Craftbukkit instance with standard config and only the attached TestPlugin is loaded. I was able to reproduce this behaviour on Spigot and PaperSpigot aswell, though.

      If a custom world is created and the World.setAutoSave(boolean) Option is set to false, then no chunks will be unloaded anymore. I proofed this with the TestPlugin I attached to this JIRA-Ticket by logging all chunk loads and unloads to the console. The chunks get loaded as usual but won't unload at all. This leads to significant performance-problems, as no memory can be freed and the server tries to unload the chunks (eating up the available time from each tick).

      An example PaperSpigot-Timings: https://timings.aikar.co/?id=528d883f1c7d42818b62a6ffbfd5c2a6

      Instead the chunks should unload as usual, throw their respective ChunkUnloadEvents and maybe use the provided isSaveChunk() Method/Field to indicate that there won't happen any saving (if that is the intended cause from setAutoSave(false)). In my opinion setAutoSave(false) should only control of the periodic saves for the world should be enabled or disabled since that is what I expected from it.

      The described behaviour can be tested and reproduced with the attached plugin. With the command "/wchange custom" one may teleport himself to the custom-testworld and see that there will only appear "LOAD"-Events for this world. The world is created with the following code:

      World custom = new WorldCreator("custom").createWorld();
      custom.setAutoSave(false);
      

            Unassigned Unassigned
            Scrayos Joshua Küpper
            Votes:
            3 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: