Inactive [FIX/ADMN] NoLagg v1.88.1 - Prevent common lag causes on your server [2338]

Discussion in 'Inactive/Unsupported Plugins' started by bergerkiller, Sep 17, 2011.

  1. Offline


    I had already made this plugin before after having a major lag issue. (lots of torches being filled, turned into items, lag for 20 minutes) It also works for 1060.

    Some feature ideas are taken over from PerformanceTweaks by @LexManos so some credit goes to him. Code, however, written from scratch by me. :)


    If you get a warning message [NoLagg TLN] followed up with a stack trace in the log, this has to do with the main thread not having responded within 10 seconds. When a plugin takes more than this time to enable, it will show that. The warning is NOT an error and is no bug, and not a bug related to NoLagg. To disable this feature, disable 'threadlocknotifier' in the config.yml. This feature is mainly intended to notify you what plugin is causing the server to freeze, may it ever happen. It is used to debug plugins in general, as they may get stuck for whatever reason.

    NoLagg's features in a nutshell


    Prevent lag caused by many items

    Every time an item gets spawned, it is buffered per chunk. For example, you spawn 30 items using Q and the maximum allowed items per chunk is 20, then the 10 remaining items are not spawned. They are spawned as soon the item count in this chunk is < 20 again.


    Form item stacks - fully automatically

    Whenever two or more (configurable) items or experience orbs get near each other, they form a single stack of that item type. If someone drops 64 dirt blocks on the ground using Q, it will show a single item of 64 dirt instead.


    Prevent lag caused by TNT

    This plugin takes over tnt ignition caused by explosions. When exploding stacks of tnt, it does not rush all tnts into a single tick, but detonate them nicely in sync. This results in pretty awesome fireworks. :)


    Prevent lag caused by lighting glitches

    Whenever a new chunk is generated, it's lighting information is generated and all nearby players receive the updated chunk data. If the auto-method fails, you can use /nolagg fix to do it manually. This fixing fixes, for example, dark spots in and around caves lagging the client.


    Set entity spawn limits

    You can set a spawn limit on virtually every entity in the game. From mobs to items to TNT. Only thing being excluded is Players, since I can't simply kick someone 'like that'. :)
    Note: It removes already spawned entities too. So, if you want to keep your animals alive, don't set mob or animal limits, or it will possibly clear your farm animals. (or you can disable the spawn limiter all together)

    I recommend finding an alternative plugin for this instead. Removing entities after they are spawned causes more lag than it prevents!

    Global auto-saver

    Since asynchronous chunk saving is now implemented internally, it is no longer a problem to save entire worlds frequently. You can set auto-save intervals in the configuration. If used with an interval higher than 400 ticks (20 seconds) it will use a scheduled task instead of the internal saver to prevent chunks never getting saved. Another benefit is that player information is also auto-saved, preventing your players losing their inventory state.

    New chunk sending mechanics

    Instead of loading chunks all around the player, the player direction is used to load the visible chunks first. This means that players can expect chunks in front of them to load quickly, while chunks on the sides take a bit longer to appear. When the player looks into another direction, the direction changes and thus the new visible chunks get loaded first. Only if all chunks ahead of the player are loaded, chunks around the player are sent. This all can be configured using a simple minimum and maximum sending rate.


    Examining the server tick rate

    If you encounter very low tick rates and you want to find out what plugin is causing it, you can use the examine component to find it out. It comes with a graphic viewer, which makes bug tracking the easiest thing ever.


    Prevent cross-thread access for events

    As it seems, some plugins don't follow the rules and use Bukkit methods in another thread. This plugin will notify you and cancel if possible whenever this happens so other plugins understand their mistake. If you encounter a lot of spam in the console, first check the stack trace for the plugin that caused the error. Report this error to the author or remove the plugin, if you have questions you are free to ask.

    Configuration (on BukkitDev)

    Commands and Permissions (on BukkitDev)

    Synchronized code accessed by another thread? (BukkitDev)


    Video by brandcool86


    - Help I experience missing chunks
    If you are using Spout, don't use Reloads. This is also the reason why Spout added a warning when a player tries to reload the server. Not using Spout, then it's a bug which you can report.

    - Can this plugin be used with PTweaks
    (this message was really old...) Yes, they are compatible, but if certain features overlap, make sure you disable these features in either plugin.

    - I get a warning about the async auto save and interval. Wat do?
    Change the autoSaveInterval value in the configuration to a value higher than 400, like 600. The warning is to prevent endless autosaves to occur, clogging up CPU.

    - I have experienced CPU usage
    CPU usage is not the same as lag. NoLagg uses multiple (2-3) extra threads to prevent tick and network lag. If a lot has to be done, it does this quicker, but this takes more CPU obviously.

    - I have lag when using NoLagg
    See also the FAQ above. Explain what type of lag you have: tick lag, client lag, network lag and/or 'block placement' lag. You can use /nolagg monitor to check the tick rate. If this is normal (>15), then you have network lag. Client lag is when the FPS drops. Block placement lag is lag when the tick rate is normal and other network messages, like chat, are instant.

    - WorldEdit causes lag...
    YES because it is unsafe to take over the main thread while another plugin is having hold over it. I can try fixing this, but it could ultimately lead to some serious concurrency exceptions. Don't expect this to be implemented very soon...

    - Do spawn limits interfere with mob-spawning plugins like MobArena?
    No, it does not. It only limits mobs spawned by 'nature': all custom creature spawns are ignored throughout the run of the plugin. Only after you reload will it lose track of these entities and will it remove custom-spawned mobs. If you use MobArena, be sure nothing is going on when you reload the server.

    - Does item stacking interfere with Showcase or BleedingMobs?
    It supports Showcase and ShowcaseStandalone entirely. (showcased items are completely ignored at all times) The same applies to the 'particles' created by the BleedingMobs plugin. Know of a plugin where it stacks items which should not be stacked? Post the plugin name so I can add support. You are an owner and want to add support? Only having a function in your plugin to check if an item is 'ignored' is enough.

    - Can this plugin be used with Chunk Manager
    If you want to use the Chunk Manager with Nolagg, disable the chunk sending of Nolagg first. If you don't do that, this plugin will do that by itself and send a warning in the log. Of course, compare the results first. :)

    - What are the best settings if I have a lot of RAM memory?
    This plugin does not deal with reduced RAM memory. If I could, I would, but you simply can't reduce the amount of memory Java uses. This data is locked and secured, so I can't simply throw away bits of data or write and read data from/to disk. Any plugin claiming to reduce RAM usage on a server, is probably 'garbage collecting'. This fakes having less RAM usage by removing unused data, but Java does this by itself as well once it hits a certain limit. All these plugins will do is make the Garbage Collector run in overdrive, which will only kill your tick rate and/or CPU speeds. A bad thing.

    - I get a lot of 'Synchronized code accessed from another thread' errors
    Find out what plugin is acting up by inspecting the stack trace. If the plugin that causes this is inactive, all you can do is wait for a refurnished version or someone to fix it for you, or use an alternative plugin. If it's still under development, notify the author of this, it IS an error caused by that plugin. If you can't find out the cause, PM me or post in this thread.

    Before you begin writing a lag issue

    This is very important, just posting a 'it causuz lagz und shitz' won't do, won't help and I won't be able to help you any further either. Question is if I even want to help you, if you post such a message without anything worth looking at. Things to include in your message:
    - Errors in the log if possible
    - What CB version you use and what NoLagg version you use
    - When this lag occurs. Tick rate drop in general?
    - The configuration you used when running this plugin
    - What type of lag if applicable. Options are: tick lag, client lag, network lag (see above)

    Important links

    NoLagg Download page and others at Dev Bukkit
    View the source code of NoLagg at GitHub

    Use an archive extracting program (WinRar, WinZip) to open the archive.

    - Add option to disable physics when the tick delay becomes too high


    Show your appreciation for my plugins by donating
  2. Offline


    OK, I somewhat figured out the issue. Mobs wouldn't spawn because of multiworld difficulty being set to 0. I changed it to 3 (hard) and mobs spawned again. But the more nights that passed by, the less mobs spawn at night. By usually the third or fourth night mobs completely stoped spawning. I have to type /butcher (command from WorldEdit) which then says about 232 mobs killed. Mobs spawning then repeats the above process as I said.
    I believe this has to be because of NoLagg limiting mob spawning, but I don't have that set to in the config! Is something wrong in my config (above)?
  3. Offline


    @nunber1_Master everything is fine, and if no spawn limits are set or if the feature is disabled, it will never limit mobs. This is because spawn limits for a mob is set on infinite (-1) by default.
    public class SpawnLimiter {
        public SpawnLimiter() {
        public SpawnLimiter(int limit) {
            this.limit = limit;
        public int count = 0;
        public int limit;
        public void reset() {
            this.count = 0;
        public void clear() {
            this.count = 0;
            this.limit = -1;
        public boolean canSpawn() {
            return this.limit == -1 || this.count < this.limit;
        public void spawn() {
        public void despawn() {
            if (this.count-- < 0) this.count = 0;
    Every entity name gets multiple of those for every world separately, and as you can see: the default limit is -1.

    I'm not sure why it doesn't spawn as much, are you using PTweaks by any chance? (it also has a limiting feature, which is enabled by default, which simply toggles animal/monster spawning on and off)
  4. Offline


    This plugin fixed one of my corrupt worlds for my server
  5. Offline


    no i am not
  6. Offline


    @nunber1_Master theeen I'll take another firm look at all the entity-related coding, just in case, this issue DOES go away if you disable NoLagg again? (what are the results if you disable chunk unload delays, if you haven't done that already)


    Ok I have only one explanation, which could be right.
    This plugin unloads chunks in another thread. Right before it unloads the chunk, it sets all the entities inside to 'dead'. But, since this chunk is unloaded on another thread, the main thread performs a last-tick operation to remove the entities from that chunk. This results in chunks getting saved without entities, which in the end causes a lot of entities to get removed.

    I need you to check this: disable auto-saving on a world and see if the mob count is now stable. I'll think of a solution in the meantime. (/save-off)


    Nope that isn't it, entity count when scheduling and when saving are exactly the same, so no entities get removed from the chunk...
  7. Offline


    so /save-on then yes :D
    ok, well, the days of mobs spawning are going from 5 days top, but now sometimes only two days :/
  8. Offline


    I seem to be getting chunk leaks again(memory leaks), where chunks won't unload and it would cause the server to run out of memory. It doesn't matter if I have chunk unload delay on or off I'm getting the leaks regardless, the only way to fix the leaks is to remove the plugin.

    after moving around one of my worlds then leaving with the plugin enabled. world guard output.
    worldv2 (0)       :
            Seed              : 6891032745851615574
            Environment       : NORMAL
            Player count      : 0
            Entity count      : 706
            Loaded chunk count: 3262
            Spawn location    : Location{world=CraftWorld{name=worldv2},x=-204.0,y=64.0,z=248.0,pitch=0.0,yaw=0.0}
            Raw time          : 61735579
        Entities   :
            CraftSheep   : 298 [0.091355]
            CraftSlime   : 2 [0.000613]
            CraftSkeleton: 28 [0.008584]
            CraftEnderman: 3 [0.000920]
            CraftPig     : 114 [0.034948]
            CraftWolf    : 35 [0.010730]
            CraftCow     : 54 [0.016554]
            CraftItem    : 85 [0.026058]
            CraftZombie  : 16 [0.004905]
            CraftSpider  : 3 [0.000920]
            CraftChicken : 32 [0.009810]
            CraftSquid   : 8 [0.002452]
            CraftCreeper : 28 [0.008584]
    doing the same on one of my worlds with the plugin removed.
    world (2)         :
            Seed              : 4681951721420010592
            Environment       : NORMAL
            Player count      : 0
            Entity count      : 41
            Loaded chunk count: 282
            Spawn location    : Location{world=CraftWorld{name=world},x=114.0,y=64.0,z=71.0,pitch=0.0,yaw=0.0}
            Raw time          : 398860469
        Entities   :
            CraftPig     : 1 [0.003546]
            CraftCow     : 7 [0.024823]
            CraftPainting: 1 [0.003546]
            CraftSheep   : 8 [0.028369]
            CraftItem    : 17 [0.060284]
            CraftMinecart: 4 [0.014184]
            CraftWolf    : 3 [0.010638]
  9. Offline


    So anyone who uses with worldedit can they describe their experience with this plugin?
  10. Offline


    @nunber1_Master do you use any other plugin to control mobs in any way?
    I know this issue from CustomDifficulty...dunno how other plugins are going.

    @shanko I don't have any troubles with WorldEdit and NoLagg, how comes to your mind? oO
    Its fine.^^
  11. Offline


    @cartman-2000 I don't know why, but when I perform the exact same experiment I can see the chunk count slowly declining from 661 chunks to 0 gradually. (I have disabled 'keep spawn loaded')

    I honestly can't tell what the problem is, are you sure there is not some sort of other plugin around that can cause this?


    Mmmh wait, when I enable the spawn again, it increases to 1200 chunks and 0 unloadable: why can't he unload those chunks?!


    Sigh ok got it. Gotto love logic errors -.-
        public boolean isNearChunk(int cx, int cz) {
            return Math.abs(cx - this.x) < 12 || Math.abs(cz - this.z) < 12;
        public boolean isNearChunk(int cx, int cz) {
            return Math.abs(cx - this.x) < 12 && Math.abs(cz - this.z) < 12;
    Updating it...
  12. Offline


    the old AND vs OR deal lol :)
  13. Offline


    @fffizzz So glad I added that monitoring feature, else finding out the cause would be a pain right now...
    But ok, updated :)


    Uploaded 1.54.7 for the Spout users among us. Spout overrides the sending queue, had to manually make sure that Spout stopped doing that :)
  14. Offline


    yes a few, i actually mad e a post about this issue to the multiworld author, then found out that it must be nolagg
    all i have is multiworld, nogrief, mobarena, mobbounty, and towny.
    the difficulty in multiworld config is set to 3 (hard), towny does have world mobs on, nogrief only edits creepers no blowing up the land (and I think enderman not picking up all blocks), mobarena doesn't seem related to this issue, and mobbounty gives me money for killing monsters
  15. Offline


    @nunber1_Master this issue still happens with 1.54.6/7? I recently changed the chunk unloading bit, it's possible that too many chunks were loaded on your server too, resulting in less mobs/chunk on average.

    Ugh this is tiresome...I've had to re-upload this plugin four times because of the stack former giving issues...I seriously hope it is now fixed in 1.54.8...

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Jul 14, 2016
  16. Offline


    updating now ill edit this post with the results

    Monsters do spawn, but by the third night I have to wait a little longer for monsters to spawn, and that extends through every day on.
    I was flying when I was testing it this time, so I started to walk/sprint. Some more monsters did spawn, but not as many as I expect would spawn on hard.
    I'll try lowering my chunkunloaddelay a little lower.

    Monsters spawn a lot more then they used to. Now I think it has to do with the chunkunloadelay. The lower it is, the more monsters spawn. I brought mine down to 5000 (again) and monsters spawn a lot more then they used to. This didn't work before.
    Thanks, and I shouldn't bother you with this problem anymore.

    Edit: Eventually it takes some time for a bunch of monsters to spawn, but I'll live with it since it is better then it was before!
  17. Offline


    I suffer from havy tick-drop with "chunkSending" enabled, when teleporting into "not loaded chunk areas".
    When I was running through my world, lets say at x:1000 z:1000, then died (->teleported to spawn at x:0, z:0) I even got a read time out error one time.
  18. Offline


    @Sepulzera chunks are also loaded during chunk sending, so the chunk sending times include the time it took to load all the chunks.
  19. Offline


    I don't know how it is related to me tick-drop issue and what does it mean?
  20. Offline


    @Sepulzera it means that it took long to load/generate the chunks needed to send the chunks to the players in that tick. Also, if the send rate is set too high, it may cause an increase tick drop due to the large amount of data transfer.

    May push chunk sending on a separate thread also, only sending the chunks it can actually send. (actual chunk sending is on another thread anyway)
  21. Offline


    Using the default config for chunkSending, as I don't know how to configurate it properly ;)
    And it is working very well, just if you teleport to an unloaded area...
  22. Offline


    @Sepulzera Nothing I can do about that sadly, chunks have to be loaded from file...and this read operation from disk can take a while. (including the decompression of the data)
  23. Offline


    yea but it shouldn't drop the tick down to 0 for several seconds, should it?
    Or even cause read time out errors...
  24. Offline


    @Sepulzera Mmmh no not many chunks are actually sent?

    Oooow wait, I know what's going on. In the configuration, set the 'boost' to 0. Right now it will insta-send (and thus load) 25 chunks in a single tick, my guess is that is acting up.
  25. Offline



    After that update:
    Spawn limiter
    - Now uses less hashmaps to achieve the same, greatly improving entity limit lookup speeds
    Mobs keeps spawning (a lower number, btw) on my server even when i set it to '0' in config. I have to say my server is very populated (over 300 players) and most of the time the tickrate is very low. Maybe this is causing the issue ?

    Running the previous NoLagg version works like a charm btw.
  26. Offline


  27. Offline


    @spunkiie yeah I noticed that the native server keeps on spawning mobs, because the creatureSpawn event is broken. It does cause lag, but it's pretty hard to get around it. I could go and toggle mob spawning on and off like Performance Tweaks did, but this doesn't work for stuff like arrows obviously. I could also disable all spawning alltogether and use my own spawning algorithm..but that takes long to make :/
  28. Offline


    Do you have some sort of build server such as jenkins?
  29. Offline


    @andrewkm no, but the GitHub download page got the latest version (also for me) for now. I need to work on TrainCarts a bit more, else I never get it finished...
  30. Offline


    Getting following error spam
    2011-12-31 22:24:31 [SEVERE] java.lang.NullPointerException
    2011-12-31 22:24:31 [SEVERE]  at net.minecraft.server.World.a(
    2011-12-31 22:24:31 [SEVERE]  at net.minecraft.server.ChunkLoader.a(SourceFile:140)
    2011-12-31 22:24:31 [SEVERE]  at net.minecraft.server.ChunkRegionLoader.a(SourceFile:84)
    2011-12-31 22:24:31 [SEVERE]  at com.bergerkiller.bukkit.nolagg.ChunkSaving.saveChunk(
    2011-12-31 22:24:31 [SEVERE]  at com.bergerkiller.bukkit.nolagg.ChunkOperation.execute(
    2011-12-31 22:24:31 [SEVERE]  at
  31. Offline


    @andrewkm you are using the latest CB version and latest NoLagg version? The Dummy World generation is pretty sensitive, do you get any errors related to that when NoLagg enables?

    Looked at the source code, for that to happen THIS must fail:
    So it can only be that you use an outdated Craftbukkit version and it fails to find that L variable in the world class.

Share This Page