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


    For me, NoLagg:
    v1.43 and below (I don't know until what version) - Memory leak
    v1.44 - No/Not much memory leak, very good constant ram usage for 16 hours (restart)
    v1.45 - Memory leak back.

    I am still looking forward to the NoLaggChunks to be perfect! Keep up the good work berger!
    kahlilnc likes this.
  3. Offline


    Yeah 1.44 is working perfect for me ;( to bad I do a every other hour restart :O But yeah Ima keep nolaggchunks then
  4. Offline


    nolagg monitor says....
    200 mobile TNT

    config (open)
    tntDetonationInterval: 1
    tntDetonationRate: 50
    explosionRate: 50

    Could you explain this? Seems I missunderstood sth here...
  5. Offline


    I think the latest build has another memory leak its using a lot of ram and all the cpu so get a fix out quick.
  6. Offline


    Getting a lot of "Wrong entity location" (All kind of mobs) errors with 1.45

    Downgrading to 1.44 did not change that
    It seems it was nolaggchunks fault , unfortunately after removing the addon , errors still poping out in console.
    I hope the map is not corrupted ...
    After some time errors stopped.
    30 minutes of running nolaggchunks caused :
    - parts of chunks did not save on stop
    - some chests got wiped
    - some signs got wiped
    - major lag after ~15 minutes server running with 10-15 players
  7. Offline


    @Sepulzera Detonation rate means 'the amount of TNT detonated (block -> mobile) per tick. Since TNT entities stay alive for a few seconds, it obviously has more TNT's than the rate.

    The message:
    2011-11-12 01:04:47 [WARNING] [NoLagg] Chunk [-26/-134/OmegaCraft] was restored from the chunk saving queue
    Is sent out whenever a chunk is queuing to be saved, while it is requested to be loaded. This can happen if the player is walking away from a chunk, waits for the exact time as the unload delay, and requests the chunk to load again. It can also happen if a chunk is unloaded, but instantly loaded again by another plugin. (for example, a plugin that requests a certain block). This reduces disk usage, so it's not really a warning. Added the message to check how often it happened, more often than I initially thought. :)

    Could someone using 1.45 log their server? (/nolagg log) and send the log file (NoLagg/log.txt) to me? It can help me understand what causes the leak. (could be many things, from chunks kept in memory to some random issue)

    I also see that manually saving chunks can be a pain, I recommend using 1.43 or lower (or disable chunk unload delays & async saving). I'll look into those issues for now, wrong entity locations did happen to me too (but on other worlds), could be I need to store entity locations too.
  8. Offline


    Just to expand on that @bergerkiller said about it.

    Read the top of the thread for Christ sake.
    Sets the interval 
    (in ticksat which TNT groups are being spawnedEvery [tntDetonationIntervalticks [tntDetonationRateTNTs are spawnedYou can freely set this valueYou can balance it manuallysomething like [interval:10 rate:10will have the same effectbut will leave a short pauseInterval is an average intervalsince TNTs are detonated with a random fuse.
    Sets the amount of TNTs being spawned every interval
    Setting this too high can eventually cause server-lag. (lots of chunk updatesPlease keep this value under 50-100, as this directly influences the amount of block changes that occur.
    Sets the maximum allowed explosion packets being sent per tick
    Setting this too low will take away the fun of TNTbut setting it too high will cause massive network usage and client lagIt depends on your connection how well clients can handle explosion packetsKeep this below 20higher values can cause clients to freeze because of the large amount of explosions.
    You prefer this with a server with players on it lol or does it not matter.

    FYI I have chunkunload disabled and Async disabled since Async possibly destroyed the world last time. I become a custom to your work while being reliable when a flaw free update is out, it usually comes with experimental changes that don't always work well on their first outing, leading to you releasing an update a couple days later to fix or try to fix it, I understand that it happens I don't complain about it :p, though in light of this I tend to er leave you experimental features off or wait a few extra days to see what the crowd says before updating on the main server.

    I don't appear to be having as bad an issue with at these people are saying tho, I noted it is using more cpu and ram but its not crazy amounts maybe spikes a little every couple mins but it does not stay there.

    I know it will get fixed so that is why I trialed nochunks and the new nolagg on test server first.
  9. Offline


    @ledhead900 I'd prefer it to any server that has this memory leak over time. :)

    Also, after flying around the buffered chunks went upto 536, but didn't increase much further. Not sure if there is a memory leak at all...not a lack of RAM memory for the server to use unload delays. (it keeps more chunks loaded, so it obviously uses more RAM)


    nvm, it now is 615, while the total chunk count stays the same. I'll look at the hashmap I recently change from weak to normal, as it was taking up CPU to clear it.
  10. Offline


    @bergerkiller Ah, thanks. It's just I don't want my server.log to get too big, lol. I'm in the process of updating a few plugins, but when I'm done I'll get a log for you, though I don't use NoLaggChunks...
  11. Offline


    Well alright I have not installed the latest or nochunks on main server yet as I read it had issues and just tested it on my other private server.

    Give us a yell when you think its ready for live servers and stable again :), Sorry but I will have to sit on the bench this time around.
  12. Offline


    @ledhead900 Sure. Problem is you can't debug everything easily when alone on a server, so even after debugging for 8 hours things like this still manage to happen.
  13. Offline


    CB#: 1185

    I know I'm not using an updated CB but is this problem related to that? I'm using NoLagg v1.44

    2011-11-12 07:15:32 [SEVERE] Error occurred while enabling NoLagg v1.44 (Is it up to date?): org/bukkit/configuration/file/YamlConfiguration
    java.lang.NoClassDefFoundError: org/bukkit/configuration/file/YamlConfiguration
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClassCond(Unknown Source)
        at java.lang.ClassLoader.defineClass(Unknown Source)
        at Source)
        at Source)
        at$000(Unknown Source)
        at$ Source)
        at Method)
        at Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at com.bergerkiller.bukkit.nolagg.NoLagg.onEnable(
        at org.bukkit.plugin.SimplePluginManager.enablePlugin(
        at org.bukkit.craftbukkit.CraftServer.loadPlugin(
        at org.bukkit.craftbukkit.CraftServer.enablePlugins(
        at net.minecraft.server.MinecraftServer.e(
        at net.minecraft.server.MinecraftServer.a(
        at net.minecraft.server.MinecraftServer.init(
    Caused by: java.lang.ClassNotFoundException: org.bukkit.configuration.file.YamlConfiguration
        at$ Source)
        at Method)
        at Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 26 more
  14. Offline


    @Errored yup that's the problem. YamlConfiguration (in Bukkit) was introduced in 1317 / 1337, any CB below that will fail because that class doesn't exist.
  15. Offline


    Ah, okay. Thanks. Guess I'll downgrade.
  16. Offline


    Here's my log. I'm not using NoLaggChunks and "chunk unload delay" and "async saving" are both disabled. Also, it's real early right now, so I only had 12 or so people on the server. But anyway, hope it helps.

    Note: Sorry, the formatting was REALLY messed up. I couldn't get pastebin to show it straight. So, if you wanna take a look at it, I uploaded it.
  17. Offline


    @Chrispm84 wait so there is a memory leak without those two enabled? (D'oh)


    There is a slow but existent memory leak. It's definately not the chunk handler, but it could possibly be the item handler. It solely relies on chunk load and unloads, but even then it could potentially store a chunk which is unloaded. Other than that didn't notice anything weird.
  18. Offline


    I understand no worry's, Thing is my server is not really alive enough to test it yet as my I have issues the word not bother building on main server until 1.9 or what ever is the next update version as its all being thrown out for a new server design that is more fun and more original. So its just me and some mates on test server right now with the odd guest or 4 that wander into the main server for playing.

    Ofc I will advertise again I plan on going nuts with marketing the new server once its stable.
  19. Offline


    ok found it out. A very simple issue. Instead of using a chunk view distance set in the properties, it was using the internal default: 16. This means that there are (16 + 16 + 1) ^ 2 = 1089 chunks allowed around the player...that is kinda ridiculous.

    using 10 as default, it should be 441. chunks. It obviously starts to eat RAM then...
  20. Offline


    What is this RAM issue people are talking about? If anything, it is the CPU I notice it on.
  21. Offline


    @ProjectInfinity On online servers the garbage collector (GC) is continuously clearing RAM, and this takes a lot of CPU. If you have a lot of RAM, it could still be that a little of it is allocated, causing the GC to overturn. Check /nolagg monitor and watch for the amount of GC collects.

    Note that will I also change the 'isPlayerNear' function (again sigh) as it was using an array generated from the list for every single chunk. Takes a bit too long to perform.

    Also noticed that, sometimes, the chunks are unloaded and loaded continously. This also results in that 'restored from saving queue' warning.
  22. Offline


    By GC collects you refer to the green (GC) next to RAM?
  23. Offline


    @ProjectInfinity yup, whenever the RAM usage goes down it shows the green GC. If that occurs VERY often (like, every 0.5 second) then I strongly suggest not to use chunk unload delays if you have a weak CPU.
  24. Offline


    Alright, I didn't test it thoroughly, I'll log about 10 minutes and post the results later.
  25. Offline


    Ok I also found out why all these 'entity in wrong chunk' errors pop up. Because I am saving chunks async, these entities can still move while the chunks are queuing to be saved. This is mostly the case with the async autosaving feature. Chest wiping is a bit weird, I'll have to look into that.

    Note that the warning is not severe: the server easily transfers the entity to the correct Chunk. So don't worry about it.
  26. Offline


    If I may suggest something , the Showcase plugin which I use , forces frequent chunk reloads - maybe this is the reason for wiping ?
  27. Offline


    @Lexington interesting, that could be the case actually...
    Do you notice lots of + and - next to the chunks output when using /nolagg monitor?


    IMPORTANT NOTICE. If you use this plugin with an auto save interval lower than 400, either set async saving to false or increase this interval. Otherwise it will force a global world save at a very high rate, async, which can cause the weirdest things to happen!

    (in the next version it won't even use async auto saving if it's lower than that)
  28. Offline


    @bergerkiller I'm watching this now
    NoLagg 1.45 + NolaggChunks both enabled , setting autosave interval to higher value (1000) helped.
    Sign wipind does occur as I write this , i leave it running for few minutes and provide nolagg.log

    18 players at the moment

    Highest observed value +441
  29. Offline


    @Lexington ok thanks for the effort, I appreciate it. :)

    Also going to add a 'saving queue' size indicator in the next version. Noticed it can rise up to 1600 chunks, which it saves around 400 per second. Imagine that running on the main thread...

    While there is no chunk leak, the RAM size did increase up to 600 mb in the end, which is kinda weird. Starting to doubt if NoLagg can do anything against it...
  30. Offline


    Okay here is the server log and NoLagg log.
    Hope it help with debugging.

    So far so good - server runs i leave it for a while
  31. Offline


    @bergerkiller I had to remove NoLaggChunks because this new version caused all my signs to appear blank. When I remove the jar file, all the signs are fine. So the text was still with the sign, but was not being displayed.

Share This Page