Villagers keep chunks permanently loaded?

Discussion in 'Spigot Discussion' started by uncovery, Mar 21, 2018.

  1. HI all,
    in the quest to track down lag sources, I wrote a plugin that lists all the currently loaded chunks into a database. When overlaying those chunks with a map I realized that the chunks that were always loaded were apart from the spawn area the chunks with villagers. Those included areas far and wide from any recent user interaction.

    Is this normal? Or could a plugin I have running on my server do that?
    How can I prevent that? I want to avoid that, with the growth of my map or with users creating villager farms, those areas stay loaded 24/7 and lagging my system more and more.

    I am thinking of writing a plugin that forcibly unloads chunks that don't have any users nearby. Is that risky in any sense?

  2. It certainly could. List your plugins.
  3. If you have the plugin Citizens, it could simply be an npc from the plugin and not a natural spawned one.
    • Useful Useful x 1
  4. I don't have any plugins that would manipulate citizen behavior - to my knowledge:

    WDLCompanion, WSEvents, PlaceholderAPI, Websend, TuxTwoLib, RateOfXray, SpawnerGuard, PlayerHeads, dynmap, WorldEdit, WorldBorder, Modifyworld, Votifier, BetterPvP, ProtocolLib, Multiverse-Core, StayInsideTheNether, bShortcut, RealDisguise, PermissionsEx, GhostBlockKiller, Multiverse-Portals, Hats, Vault, PlayerMarkers, LogOres, LogBlock, PerWorldInventory, WorldGuard, Multiverse-NetherPortals, afkTerminator, VentureChat, Essentials, DiscordSRV, EssentialsSpawn, PurpleIRC
  5. I'm seeing the same thing here and I also wrote a plugin to find out why. Plugins that we have in common are: PlaceholderAPI, dynmap, WorldEdit, Votifier, Multiverse-Core, PermissionsEx, Vault, PerWorldInventory, WorldGuard, Essentials, DiscordSRV, EssentialsSpawn
  6. Could be that some players on your server are using some redstone mechanics to achieve this... hoppers can keep chunks loaded, potentially indefinitely if you have knowledge about how chunk loading works.

    Also could be that that a nether portal is causing the chunks to load by items or mobs getting sent through it or something. Is it just some random village or is there stuff built there?
  7. I have experienced this even in mint areas with naturally generated lots.
  8. I've been looking into it. This happens even when you do a restart with no players. It loads up stored villages and for some reason the chunks keep getting reloaded (a plugin unloading the chunks doesn't appear to work). I suspected it had to do with this commit:

    I also found this on the issue tracker:

    I did my own tests on various builds and it does seem to happen after that commit. There's just no obvious reason why. Looking at the persistent village code makes me think it's supposed to work like this, but it shouldn't and didn't.
  9. @PseudoKnight thanks a lot!
    I assume it's the "tick-inactive-villagers: true" config that needs to be changed here. I don't really understand which behavior breaks if this is set to false. Any idea?

    Also, any idea how to create those graphs that are attached to the bug report? It seems they are created with Munin, but which plugin for spigot can interface with Munin like that?
  10. The behavior that it fixes has been broken for a long time. I hope this change is fixed or we least figure out what's going on here. I see no reason it would be unique to certain servers, just ones with persistent villages.

    I'm not sure which graphing application that is. I use different tools for profiling.

    I should mention that of the plugins listed above, I matched only dynmap, WorldEdit, WorldGuard and DiscordSRV. Only WG popped up in my profiling and not in a way that would indicate its involved. It doesn't mean none of them are triggering this issue, but it's more likely that -- if it's specific to a subset of servers with persistent villages -- it's something about our configurations. These are the only related things I changed, I think.

    random-light-updates: true
    view-distance: 8
    animals: 20
    monsters: 32
    misc: 16
    players: 112
    animals: 48
    monsters: 48
    misc: 32
    other: 112

    I also noticed months ago that iron golems were building up on some farms in areas chunks should have been unloaded. I was able to fix this by unloading the chunks on the creature spawn event if players weren't nearby. I never followed up to see if anyone else noticed this.

Share This Page