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


    @ledhead900 What other plugins do you use? The second error can only be caused if some sort of plugin decides to remove or add an element from another thread using some sort of function I haven't synchronized...
  3. Offline


    Terrain Control < Custom World generator supports bo2 file creation in world as you explore as well its the successor to phonexterrain and you know the kinds of hardcore stuff that thing can do.

    It has to be it, as these are the only plugins I use on test server to build the world I am working on.

    2011-12-11 23:33:21 [INFO] Plugins: BorderGuard, CommandBook, My Worlds, TerrainControl, WorldEdit, WorldGenerationControl
    The last one is a run once thing its not actually doing anything until I command it to do so, it generates explored chunks for me at a set radius and fixes lighting while it does it, I use this to pre gen my worlds before moving to Mcedit to fix lighting properly overnight by rebuilding it then I export it to my Live server.

    Anyway You might want to add support for Terrain Control as it is the successor to PhonexTerrain mod and I would assume a lot of people will come to use this once reco is out.

    99% sure it is Terrain Control, I don't have to use it once worlds generated as I generate a padding over 500x500 past the borderguard , to stop people going anywhere too far past a set limit and the buffer/padding just stops any chance of NON modified terrain from generating near the border, pretty much I just set border 500x500 LESS than total map size to prevent unwanted generation. So this issue would probably not occur on my live server but it does while I am testing out various other terrain tweaks and exploring normally.
  4. Offline


    @ledhead900 Ok I found one possible issue. In native coding, there is an unsynchronized sort code. This could cause everything to break. Now adding a separate synced bit where I can schedule chunks cross-threads. (Operation.postexecute)
    It was nice having it all synchronized, but this proves that not everything is as simple.
  5. Offline


    Must be that Terrain Control is calling this sort code, It would have to as I assume your familiar with PhonexTerrain Mod and what it does, It would have to make use of all the terrain code in native minecraft to do its job and it is likely its using something you have not accounted for.
  6. Offline


    Bukkit: 1572
    NoLagg v1.52.5

    2011-12-11 09:03:29 [WARNINGTask of 'NoLagg' generated an exception
        at java
    at java.util.ArrayList$
    at com.bergerkiller.bukkit.nolagg.ChunkSendQueue$Operation.execute(
    at com.bergerkiller.bukkit.nolagg.ChunkSendQueue$Operation.execute(
    at com.bergerkiller.bukkit.nolagg.ChunkSendQueue.access$1(
    at com.bergerkiller.bukkit.nolagg.ChunkSendQueue$
    at org.bukkit.craftbukkit.scheduler.CraftScheduler.mainThreadHeartbeat(
    at net.minecraft.server.MinecraftServer.w(
  7. CB : 1572
    Nolagg : latest

    Can't pickup dropped items !
  8. Offline


    agreed D:
  9. I found a problem.
    I use the lastest version 1.52.5 and CB 1576
    2011-12-11 23:44:23 [SEVERE] [NoLaggAn error occured while performing a routine update:
    2011-12-11 23:44:23 [SEVEREjava.util.ConcurrentModificationException
    -12-11 23:44:23 [SEVERE]     at java.util.WeakHashMap$HashIterator.nextEntry(Unknown Source)
    2011-12-11 23:44:23 [SEVERE]     at java.util.WeakHashMap$ Source)
    2011-12-11 23:44:23 [SEVERE]     at java.util.WeakHashMap$ Source)
    2011-12-11 23:44:23 [SEVERE]     at com.bergerkiller.bukkit.nolagg.ChunkHandler.cleanUp(
    2011-12-11 23:44:23 [SEVERE]     at com.bergerkiller.bukkit.nolagg.NoLagg$
    2011-12-11 23:44:23 [SEVERE]     at org.bukkit.craftbukkit.scheduler.CraftScheduler.mainThreadHeartbeat(
    2011-12-11 23:44:23 [SEVERE]     at net.minecraft.server.MinecraftServer.w(
    2011-12-11 23:44:23 [SEVERE]     at
    2011-12-11 23:44:23 [SEVERE]     at
  10. Offline


    While using this plugin with only 3 players on, the mob count was at 1000, and for some reason, there were item drops. Then I realized - animals keep chunks loaded.

    Could there be some way to record how many animals are in a chunk, then when the chunk is left, it is unloaded with the animals on record? I don't really want to get rid of their spawning, but it's just a nuisance. Perhaps it could be done by despawning the animals, then recording them.

    Of course, I'm also running RegrowingSheepcoat, so doing so may interfere with that plugin. However, having the plugin record the time of each sheep's despawning, color, and whether or not they have wool, when players go near the chunk, a time check could be done to see if the wool is to be regrown.

    Either way, I'm very satisfied with this plugin. It's awesome, and honestly, I love you. Not in the romantic sense of course. ;)
  11. Offline


    2011-12-12 11:33:13 [WARNING] Task of 'NoLagg' generated an exception
    java.lang.ArrayIndexOutOfBoundsException: 112
        at java.util.LinkedList.toArray(Unknown Source)
        at java.util.Collections.sort(Unknown Source)
        at com.bergerkiller.bukkit.nolagg.ChunkSendQueue.update(
        at com.bergerkiller.bukkit.nolagg.ChunkSendQueue.access$6(
        at com.bergerkiller.bukkit.nolagg.ChunkSendQueue$1$1.handle(
        at com.bergerkiller.bukkit.nolagg.ChunkSendQueue.access$7(
        at com.bergerkiller.bukkit.nolagg.ChunkSendQueue$
        at org.bukkit.craftbukkit.scheduler.CraftScheduler.mainThreadHeartbeat(
        at net.minecraft.server.MinecraftServer.w(
    Seems your chunk sending doesn't work with current CB-builds, chunk generating is very slow, either :\
  12. Offline


    I can't tell what is going wrong index out of bounds error inside Java coding is a bit weird and can only be caused by cross-thread access of some sort.
  13. Offline


  14. Offline


    @Colm Not useful in NoLagg, but useful to know regardless. Thanks for sharing, and I always missed a getChunk...always used getBlock().getChunk or world.getChunkAt
  15. Offline


    Ok but just so you know I updated to the latest Dev build for you and i have no problem no errors what so ever!
  16. Offline


    @Colm I know, me neither. But some plugins access Bukkit data from another thread, and because I handle these events so much, I get to receive all those concurrency errors -,-
  17. Offline


    Ok, well its one of my favourite handy plugins. The only error i have found is when I use the command /nolagg, it does not do anything not even do "unknown command" like it did but you might of got rid of it.
  18. Offline


    We finally have an RB, CB 1597.
  19. Offline


    @QQCucumber ok thanks, I'll prepare all plugins for this new build.
  20. Offline


    @bergerkiller Hey I'm using NoLagg v1.52.5 and getting memory leaks, I found out it was NoLagg after trying to load NoLagg using a plugin loader after starting the server. I allocated 6998mb to my server according to LagMem and after a few minutes with NoLagg, it decreased from 84% to 80% slowly, and always up to 60% left of memory.

    Any idea why? Here is my configuration:
    bufferItems: true
    bufferTNT: true
    useSpawnLimits: false
    useChunkUnloadDelay: true
    tntDetonationInterval: 1
    tntDetonationRate: 10
    explosionRate: 5
    maxItemsPerChunk: 40
    formItemStacks: true
    chunkUnloadDelay: 4000
    autoSaveInterval: 400
    updateInterval: 40
    stackRadius: 2.5
    stackThreshold: 2
    monitorInterval: 40
    autoFixLighting: false
      enabled: true
      boost: 25
      minRate: 0.25
      maxRate: 2.0
    It doesn't seem to help if I disable async saving by decreasing the autoSaveInterval to 40 and unload delay lower.

    It could be my start up command line using RToolKit, any idea:
    overridden-process-arguments=java -Djline.terminal\=jline.UnsupportedTerminal -server -d64 -Xmx7G -XX\:PermSize\=128m -XX\:MaxPermSize\=256m -XX\:NewRatio\=3 -XX\:+UseThreadPriorities -XX\:+UseCMSCompactAtFullCollection -XX\:CMSFullGCsBeforeCompaction\=1 -XX\:CMSInitiatingOccupancyFraction\=90 -XX\:+UseConcMarkSweepGC -XX\:+UseParNewGC -XX\:+CMSParallelRemarkEnabled -XX\:MaxGCPauseMillis\=50 -XX\:+UseAdaptiveGCBoundary -XX\:-UseGCOverheadLimit -XX\:+UseBiasedLocking -XX\:SurvivorRatio\=8 -XX\:TargetSurvivorRatio\=90 -XX\:MaxTenuringThreshold\=20 -XX\:UseSSE\=4 -XX\:+UseNUMA -XX\:+UseLargePages -XX\:+UseStringCache -XX\:+UseCompressedStrings -XX\:+UseCompressedOops -XX\:+OptimizeStringConcat -XX\:+UseFastAccessorMethods -XX\:+AggressiveOpts -jar bukkit.jar nogui
  21. Offline


    @mrciku Do you get any errors caused by this? It's possible that it is never garbage collecting, causing the Java runtime to keep on allocating new memory until it *really* has to GC. Monitor using /nolagg monitor - do you ever get to see a green 'GC'?

    Also, try disabling features one by one until you find the cause. I doubt chunk sending causes a memory leak, since i hardly allocate new data there, but still do check. Also try disabling the chunk unload delay with it; could cause a memory leak.

    I'm going to implement a custom chunk/world meta data system to make everything a bit faster and use up less memory.
  22. Offline


    Yep, I tried doing a manual GC using VisualVM, same thing. I'll try the unload delay soon.

    EDIT: It's most of the time a green (GC)

    EDIT 2: Yep, @bergerkiller it's the chunk unload delay.
  23. Offline


    Get numerous chunk-errors, or better "missing chunks leading to big ugly holes".
    Also I kinda feel there would be numerous lighting bugs with 1.0.1-R1 now, but not "unlighted" blocks only, even "lighted" blocks that have no source :eek:

    Due to lack of time, I can't do any complicated testings next few days, so here is just my config:
    Show Spoiler
    bufferItems: true
    bufferTNT: true
    useSpawnLimits: false
    useChunkUnloadDelay: false
    tntDetonationInterval: 1
    tntDetonationRate: 30
    explosionRate: 60
    maxItemsPerChunk: 100
    formItemStacks: true
    chunkUnloadDelay: 10000
    autoSaveInterval: 200
    updateInterval: 20
    stackRadius: 2.5
    stackThreshold: 5
    monitorInterval: 40
    autoFixLighting: true
      enabled: true
      minRate: 0.25
      maxRate: 2.0
      boost: 25
  24. Offline


    Just so you all know, it's being worked on. Right now improving the code a bit more. (for example, a central spot where chunk/world related info can be found, instead of having a separate hashmap for chunks vs some data for every feature separated)

    Ok really I get more and MORE issues with other plugins modifying Bukkit-managed variables from a thread other than the main thread. For example, @Adrenaline posted an error where it had a concurrency exception while looping through the PLAYERS, come on?!

    Can anyone that had errors please post their plugin list? ( @Sepulzera @Adrenaline @mrciku )

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


    Can't rembember who reported that stuff, but I think here is the reason why someone got blocks disappearing at bedrock level when detonating TNT at the surface:
    Having a huge load of tnt will probably catapult one or two tnt entities up to 127+
  26. Offline


    @Borch ah that explains. I'll add a check against explosion/block heights.


    LOL no way. I remember someone making a screenshot if it before and I had no idea what he saw it with my own eyes. How blocks started disappearing at bedrock level when detonating a floating stack of TNT. Time to add checks :)

    Ok updated to 1.52.6. Changelog:
    - Now stores chunk/world information at one central spot to prevent memory leaks
    - Now prevents tnts exploding above the surface from breaking blocks at bedrock level (smart system)
    - Some more synchronization fixes for the chunk send queue (if the impossible happens, it will show a descriptive message in the log to what happened)
    - Better chunk unload system using the system described all on top
    - Now shows the amount of chunks generated in the log/monitored output in yellow
    - Faster chunk save processing to prevent overflows (was performing a 1 sec delay for every 200 operations)


    Still adding some 'minor' synchronization in the meta data, since people have issues with async chunk loading plugins...

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


    Hopefully SMP height adjustment is not too far off. Will this height check in NoLagg be compatible with future worlds that are higher than 128?
  28. Offline


    @GameFAQsRolo yup it uses world.height.
                        final int hborder = world.height - at.getBlockY();
                        for (Block b : affectedBlocks) {
                            if ((at.getBlockY() - b.getY()) > hborder) {
    Adrenaline and GameFAQsRolo like this.
  29. Offline


    Bukkit: 1602
    NoLagg 1.52.6

    2011-12-14 12:21:46 [SEVEREError occurred while disabling NoLagg v1.52.6 (Is it up to date?): null
        at java
    at java.util.HashMap$
    at com.bergerkiller.bukkit.nolagg.meta.WorldMetaData.remove(
    at com.bergerkiller.bukkit.nolagg.meta.WorldMetaData.deinit(
    at com.bergerkiller.bukkit.nolagg.NoLagg.onDisable(
    at org.bukkit.plugin.SimplePluginManager.disablePlugin(
    at org.bukkit.plugin.SimplePluginManager.disablePlugins(
    at org.bukkit.craftbukkit.CraftServer.disablePlugins(
    at net.minecraft.server.MinecraftServer.stop(
    2011-12-14 12:21:46 [INFOSaving chunks
    -12-14 12:21:51 [INFOConnection reset
    -12-14 12:21:51 [INFOStopping server
  30. Offline


    @Adrenaline what plugins do you run? (I ask because I don't get that error, which means that there is an asynchronous issue)


    I've had enough; decided to just check if the main thread is accessing it and if not, throw it out.
  31. Offline


    can somone please send me a .jar file? im new to plugins and server hosting and i dont know how to install this type of file

Share This Page