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


    I have to say this is one of the best addons i have ever seen. I tested this with 7 people and 653000 TNT boxes and i had no lag and no one got a DC. Thank you Bergerkiller keep up the good work :)
  3. Offline

    Nathan C


    So, for the chunkunloadelay, I have set it to 2 minutes. Is that too long? I have lots of RAM and RAM use is actually what I need, since it does not use enough!
  4. Offline


    @Nathan C Then feel free to set it to something like 5 minutes. Do watch out: Mobs will stay active in loaded chunks. If too many chunks are kept on loaded, the 'mob spread' will eventually cause the world to lose mobs for players. So, try to keep the delay < 20 minutes or so in order for mobs to despawn eventually. (no one likes a survival server without mobs)
    Nathan C likes this.
  5. Offline


    Tried running this on Build 1559 and I get big issues with it kicking players. Please can you try and resolve this problem as I have noticed right away how laggy the server is without this plugin.. Thanks
  6. Offline


    @Dark-Skript First try to lower the chunk sending rate (configuration), it is in chunks per tick. Having 0.25 is 20 * 0.25 = 5 chunks per second. Also, when do players get kicked? In general, or when someone performs a worldedit edit?
  7. Offline


    I do really feel that i get more lighting bugs with your plugin...

    Btw: It seems there are more when I stress the server (flying into not generated chunks).
    Maybe its related, dunno.
  8. Offline


    Its in general and it seems that its the players with highest pings. I am not being kicked myself as my ping is <30 but other players with the higher pings not sure exactly how much higher are being kicked.

    Also lowered it to 20 and ppl still being kicked :/

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


    @Sepulzera does it go away if you disable auto lighting fixing? If yes, then it must be a bug. If no, then it's a weird MC bug that is even harder to fix than the previous...

    @Dark-Skript Mh then I need to allow player-specific sending rates, the rate is probably too high for some players. (their packet stream is getting overloaded). Any error in the log when they get disconnected?


    Wut 20 per tick? No wonder people get kicked xd
    Assuming someone can handle 100 kb/s, then he can handle around 25 packets/sec, which is not even 2 packets/tick. So keep the max rates at 1- 2.
  10. Offline


    I couldn't notice any difference between turning it on and turning it off...
  11. Offline


    haha.. typo I meant i lowered it to 2.0, I must admit tho my server can handle more than most. It currently runs on 16gb dedicated to minecraft, Intel Xeon x8 and the speedtest:
  12. Offline


    @Dark-Skript it's not that your server can't handle it, the clients can't handle the fast chunk packet rate :)
    If possible I'll try to implement some sort of lag-based setting, for example 'min/max chunk percentage'

    Problem is that I can't test it over a local network..there's no delay.

    @Sepulzera then it can only be a native issue, I'll see if I can do anything against it.


    Ok this is awesome, I can now shield clients from that overflow error forever.
        private int averagedisturbance = 0;
        private int previoussize = 0;
        private void updateNetworkDisturbance() {
            if (queuesizefield != null) {
                try {
                    int newsize = (Integer) queuesizefield.get(this.ep.netServerHandler.networkManager);
                    averagedisturbance = newsize - previoussize;
                    previoussize = newsize;
                } catch (Throwable t) {
                    queuesizefield = null;
                    NoLagg.log(Level.SEVERE, "Failed to hook into the player packet queue size field");
                    NoLagg.log(Level.SEVERE, "Distortions in the chunk rate will cause players to get kicked");
    I will automatically adjust the rate based on the disturbance level. (which is the incrementation of the packet buffer)

    @NotYetRated yes, but at the same time it is possible for the player buffer to get filled and eventually the player will get kicked because of an 'overflow' error. I'll see what I can do, it is possible that the 'x'-field got changed lol.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Sep 9, 2018
  13. Offline


    Good idea, and thanks a lot. Your plugin rocks!
  14. Offline


    I need some testers for the 'smart' system, I can't test it on a local connection that has no buffer overflow issues. The new system should optimize the sending interval and rate fully automatically, you only have to specify the bounds of these rates.
  15. Offline


    I have
    I have issues with the old method, and just now had to disable it. Had players all night unable to play. It was not booting them, but it was not loading ANY chunks for them haha. I disabled this feature and all is well.

    But, many of those players who had issues are on now so I can test for u if u like. CB 1559
  16. Offline


    @NotYetRated see the added file in this post. Before using it, make sure you have the configuration set-up right.
    Just to make sure it does not insta-kick a player because of an overkill in rate. The maxRate is per player, not globally, it uses the average (1.05) rate for the first time and modifies it based on the chunk buffer size. I have no idea how well it'll work, since the buffer was always 0 here, but according to the code it should work right now.

            if (this.queueSizeWatcher.isMaxed()) {
                this.rate = minRate;
            } else if (this.queueSizeWatcher.isMinimized()) {
                this.rate = maxRate;
            } else if (this.queueSizeWatcher.hasRate()) {
                //update rate
                double incrementrate = this.queueSizeWatcher.getRate();
                this.rate -= incrementrate;
                //set rate bounds
                if (this.rate > maxRate) {
                    this.rate = maxRate;
                } else if (this.rate < minRate) {
                    this.rate = minRate;

    Attached Files:

  17. Offline


    okay loaded her up and this is in console.

    2011-12-05 18:15:28 [INFO] [NoLagg] Auto-save field bound to 'u'!
    2011-12-05 18:15:28 [SEVERE] [NoLagg] Failed to hook into the player packet queue size field
    2011-12-05 18:15:28 [SEVERE] [NoLagg] Distortions in the chunk rate will cause players to get kicked
    2011-12-05 18:15:28 [INFO] [NoLagg] NoLagg version 1.52.1 is enabled!
    bufferItems: false
    bufferTNT: true
    useSpawnLimits: true
    useChunkUnloadDelay: true
    tntDetonationInterval: 1
    tntDetonationRate: 10
    explosionRate: 5
    maxItemsPerChunk: 40
    formItemStacks: false
    chunkUnloadDelay: 120000
    autoSaveInterval: 1200
    updateInterval: 60
    stackRadius: 1.0
    stackThreshold: 2
    monitorInterval: 200
    autoFixLighting: false
    spawnlimits: {}
      enabled: true
      minRate: 0.01
      maxRate: 2.0
      boost: 25
    It auto-adds the "boost" again.

    Ohh yeah, but it appears noone is being booted. And no one has chunks not loading. So far anyways haha.

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


    Ahh I see haha... sooo.. should I revert for now? Ill leave it up and see what happens lol...

    Let me know of any more testing.
  19. Offline


    Hey, Pail is printing Severe Errors:

    07:41 PM [SEVERE] Could not pass event ITEM_SPAWN to NoLagg
    07:41 PM [INFO] <[Owner] Zxorm> nm u?
    07:41 PM [INFO] <[Admin] SantaClawzz> yeohyaho
    07:41 PM [SEVERE] Could not pass event ITEM_SPAWN to NoLagg
    07:41 PM [INFO] <[Member]skyra_pk> just working on acrobatics :D
    07:41 PM [SEVERE] Could not pass event ITEM_SPAWN to NoLagg
    07:42 PM [SEVERE] Could not pass event ITEM_SPAWN to NoLagg
    07:42 PM [SEVERE] Could not pass event ITEM_SPAWN to NoLagg
    07:42 PM [INFO] [PLAYER_COMMAND] Backstabber_UK: /gamemode backstabber_uk 1
    07:42 PM [SEVERE] Could not pass event ITEM_SPAWN to NoLagg
    07:42 PM [SEVERE] Could not pass event ITEM_SPAWN to NoLagg
    07:42 PM [SEVERE] Could not pass event ITEM_SPAWN to NoLagg
    07:42 PM [SEVERE] Could not pass event ITEM_SPAWN to NoLagg
    07:42 PM [SEVERE] Could not pass event ITEM_SPAWN to NoLagg
    07:42 PM [INFO] Zxorm lost connection: disconnect.quitting
    07:42 PM [INFO] Connection reset
    07:42 PM [INFO] [STAB] Zxorm has disconnected. Stopping their ChatThread!
    07:42 PM [INFO] Zxorm [/] logged in with entity id 8842 at ([fragcore] 147.61116614909912, 68.0, 281.28668641479845)
    07:42 PM [INFO] Found player!
    07:42 PM [INFO] [STAB] Starting ChatThread for player 'Zxorm'
    07:42 PM [INFO] Fetching addPacket for removed entity: CraftItem
    07:42 PM [SEVERE] Could not pass event ITEM_SPAWN to NoLagg
    07:42 PM [SEVERE] Could not pass event ITEM_SPAWN to NoLagg
    07:42 PM [SEVERE] Could not pass event ITEM_SPAWN to NoLagg
    07:42 PM [SEVERE] Could not pass event ITEM_SPAWN to NoLagg
    07:43 PM [SEVERE] Could not pass event ITEM_SPAWN to NoLagg
    07:43 PM [INFO] Please respect all Players, and don't grief!
    07:43 PM [SEVERE] Could not pass event ITEM_SPAWN to NoLagg
    07:43 PM [SEVERE] Could not pass event ITEM_SPAWN to NoLagg
  20. Offline


    @Dark_Skript Weird, you got no stacktrace with those errors? (at ... lines)
    I'll check all methods, but a stacktrace will be of great help.
  21. Offline


    @NotYetRated Ok new version, fixed the field name to make it correctly load up.

    Attached Files:

  22. Offline


    Clean console start, and no issues so far. :)

    Im in the US, have multiple guys from Europe on who average higher pings and nothing negative on their end yet.

    Can this in any way affect LWC password unlocks? I have one of my euro users having to re-enter LWC password multiple times.... I have not tested disabling it and seeing if she still has issues yet just wondering...

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


    @NotYetRated AFAIK not, but maybe it resets when the chunk the chest is in, unloads?
  24. Offline


    Don't think its nolagg related, removed NoLagg and it was still happening. Sorry for the possible confusion.
  25. Offline


    @NotYetRated What are the results so far? Do chunks load quickly enough while chat messages remain instant for everyone?

    Uploaded v1.52.2, using the send limitations based on the player connection. I would like some feedback about this, so if someone complains of slow loading chunks do post that here. Overflow kicks are also of interest here, since I try to prevent these now.

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


    I take it the minrate still needs to be changed to 0.01? (mine stayed at 0.25 from the previous version). I'm quite interested to see how well this works as I have a european server but we get a lot of american players so lots of variations in ping.
  27. Offline


    For some reason after using 1.52.1 (i think) some settings have been reset, and my spawn limits got removed and replaced by just one line:
    spawnlimits: {}
  28. Offline


    @Flatliner the minimum and maximum values are boundaries for the rate. If you have an incredibly slow player and you have your minimum on 0.5, this player might get a DC. I do consider removing min/max values and stick with a global max rate instead. A minimum should actually not be needed...yet it is.

    @Borch same reaction, that's odd...didn't touch the configuration bit in any way...
  29. Offline


    Sorry was tied up at work.

    All appears to be well! Have had no complaints of chat lag, slow chunk loading or anything!
  30. Offline


    Justice to server owners (open)
    where are you getting this 10mb = 6 players from crap ?, Statistics don't always mean shit if players are not generating chunks. I thought whole point of nolagg was to decrease the bandwidth usage and cpu load. I have been runing on 10 players lagless for most from home back when I hosted on a non soho 1500 line sync.

    I now host on 2400 (Adsl2) at 1mbs up and have been for the past year or 2, in 1.7 I was WITH OUT nolagg I was running with minimal to no lag 17 players with this nolagg and the spout/ vanilla client cache I am expecting to be able to comfortable run 20.

    I had 30 plugins going as well mind you most of the lag was tick lag but this is designed to solve that and it so far is doing a good job.

    I think its just a bloated over estimate that home servers are not capable of running a decent fun community player base when it certainly is possible even on low connections speeds. I think its out right embarrassing that these 100mbs / 1gbs collated servers sometimes are set on only 30 players and still get effected by lags.

    Maybe the people who run those and setup the back end are just monkeys with wrench's , No dis respect to them but it gives me a kick reading how some big servers lag like crazy when I seem to be going just fine and guaranteed to be fine with 8 - 10 players. I share the connection as well frankly It still performs reasonably well thanks to QOS. I am able to play BF3 at around 50 - 110 ms and not impact the 10 players on much. In fact the response from returning players have told me the server latency wise is running better then it was with only 3 players then 1 player since I started using nolagg properly.

    I mean there was 2 of us on the live server I play locally of course but the other person norm cannot insta break but he could now using creative mode it was action were instantaneous for him. The chunk load stuff really saves my ass.

    I don't want to hear any more of this rubbish about home servers and 2 players max like a lot of people claim. I think its all marketing gimmick to get ppl to use paid hosting, that or they really just should stay the hell away from routers and OS's.

    I mean I can understand if they are hosting on wireless or low speed microwave at like 128kbs up but there is no reason 1mbs cannot handle at least 10 ppl. It really depends on their location from the server. I host purely for AU and I don't really care if US ppl lag a little as my player base if not for them.

    We shall see what I can push my setup too in time but I think it can only really get better the more plugins like this get better and better cache options arrive and things.

    Anyway on another note.

    I noticed in git-Bukkit-1.8.1-R4-87-gf4ed568-b1559jnks (MC: 1.0.1) and Nolagg v 1.52.1 I confirm the issue that on CB1550 - 1559 Nolagg is not retaining the mobs data this included per world mobs and global mobs.

    Every time I replace with my backup with the setting in there upon server start I check the config and the mobs are all gone, I have tested this on both CB versions. I have tried pasting them back in after the config updated and after they wipe, does not work it clears them on server start or shutdown.
    kahlilnc likes this.
  31. Offline


    I see...maybe something is going wrong with the configuration trimming. Will look at it.
  32. Offline


    Sorry about the long reply, I hope this is helpful
    2011-12-05 19:41:01 [SEVERE] Could not pass event ITEM_SPAWN to NoLagg
        at java.util.ArrayList$Itr.checkForComodification(Unknown Source)
        at java.util.ArrayList$ Source)
        at com.bergerkiller.bukkit.nolagg.Util.fillEntities(
        at com.bergerkiller.bukkit.nolagg.StackFormer.stackNear(
        at com.bergerkiller.bukkit.nolagg.NLEntityListener.onItemSpawn(
        at org.bukkit.plugin.RegisteredListener.callEvent(
        at org.bukkit.plugin.SimplePluginManager.callEvent(
        at org.bukkit.craftbukkit.event.CraftEventFactory.callItemSpawnEvent(
        at net.minecraft.server.World.addEntity(
        at net.minecraft.server.World.addEntity(
        at net.minecraft.server.Block.a(
        at net.minecraft.server.Block.dropNaturally(
        at net.minecraft.server.Block.b(
        at net.minecraft.server.BlockFlower.h(SourceFile:37)
        at net.minecraft.server.BlockFlower.doPhysics(SourceFile:28)
        at net.minecraft.server.World.k(
        at net.minecraft.server.World.applyPhysics(
        at net.minecraft.server.World.update(
        at net.minecraft.server.World.setTypeId(
        at org.bukkit.craftbukkit.block.CraftBlock.setTypeId(
        at org.bukkit.craftbukkit.block.CraftBlock.setType(
        at org.CaiusTSM.SelfPlanting.SelfPlanting.plantAction(
        at Source)

Share This Page