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

World.getEntities returns entities in border chunks

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Minor Minor
    • None
    • None
    • java -Xms128M -Xmx16384M -jar spigot-1.14.2.jar

      Java 8 build 211, Windows 10

    • git-Spigot-01d0f04-455023c (MC: 1.14.2)
    • Yes

      All entity loaded by server is keep on World entity list.

      After some traveling in the map, the world has 30 000 loaded entity and bad tps.

       

      I used two way to get total loaded entity for a world in order to analyse the issue:

      First way is a simple call to world.getEntities().size()

      The second method count entity chunk by chunk ( using nms )  :

      for (Chunk chunk : world.getLoadedChunks()) {
          for (List<Entity> slice : ((CraftChunk) chunk).getHandle().getEntitySlices())
              entities += slice.size();
      }
      

      The first call return 41K entities.

      This second method return 6K.

       

      In WorldServer the doTick use the world entity list to tick all entity, creating a lot of freeze and lag by ticking all this "ghost" entity.

      For 6 online players and 6 of view distance, the serveur use 13GB of ram because of these entities, for same config in 1.13 we use 6GB of ram.

       

      Total world result :

      Chunk by chunk result :

      called at one second interval with 6 online players

            Unassigned Unassigned
            DocVander DocVander
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: