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


    Can anyone enlighten me on what the cause of the lag in the 1.3.1 RC release is> Does anyone even know? Thank you.
  3. Offline


    Miamore Someone over at dev bukkit told me that they fixed this tick lag in the latest development build (non-RB). See if that solves your problem.
  4. Offline

    Admiral AnimE

    Thanks, the torches are ok now, only that top left area and the smoothing are weird.
  5. update to 1.3.1?
  6. Offline


  7. Offline


    It has, thank you kind sir!
  8. Offline


    Hey, i think the NLSLListener limits the MobSpawning from eggs unintentionally.
    As it is misses a handling of SpawnReason.SPAWNER_EGG. The spawnWaitTimer then results in "not working eggs"

        private long prevSpawnWave = System.currentTimeMillis();
    private static long spawnWaitTime = 3000; //how many msecs to wait spawning
    private static long spawnTime = 1000; //how many msecs to allow spawning
        @EventHandler(priority = EventPriority.HIGHEST)
        public void onCreatureSpawn(CreatureSpawnEvent event) {
            if (!event.isCancelled()) {
                if (event.getSpawnReason() == SpawnReason.CUSTOM) {
    // Insert SpawnReason.SPAWNER_EGG handling here
                } else if (event.getSpawnReason() == SpawnReason.SPAWNER) {
                } else {
                    long time = System.currentTimeMillis();
                    long diff = time - prevSpawnWave - spawnWaitTime;
                    //to prevent lots of lag because of spammed spawn events
                    if (diff < 0) {
                    } else if (diff > spawnTime) {
                        prevSpawnWave = time;
                if (!EntityManager.addEntity(EntityUtil.getNative(event.getEntity()))) {
    Would be nice to be fixed if this is the case, did check this with vanilla CB, latest beta build and with only your plugin installed.
  9. Offline


    Kademlia aah yes I see the problem here. Will change it in the next version.
  10. Offline


    Where can i find thew download link for the separate jars? i had 5 jars nolagg,nolaggchunks,nolaggexamine,nolagglightning,nolaggmonitor.

    When i download now its only nolagg.jar and bkcommonlib help please.
  11. Offline


    monir all the components of NoLagg are in one jar files, because Bukkit can't handle the cross-access properly. You can enable/disable these components in the config.yml.
    monir likes this.
  12. Offline


    Could u please add some update support (1.3)!?!?!?!
  13. Offline


  14. Offline


    Didnt seem to help a whole lot. I tried looking up chunkser on dev and list didnt find.
  15. Offline


    I get like 10 of these errors in the console every single second:
    [WARNING] Task of 'NoLagg' generated an exception

    (Does only happen when at least one player is online)
  16. Offline


  17. Offline


    bergerkiller It doesn't specify what exception. It just says "[WARNING] Task of 'NoLagg' generated an exception" and no more than that.

    Anyway, I removed NoLagg and BKCommonLib entirely, and installed them again and the error seems to be gone now :) I will come back if it occurs again.
  18. Offline


    you said the nolagg LTN thing will go away if i take off that thing in the config (sorry still half asleep, memory not good), but will it just take away the warning?
    whenever i get the warning, the server crashes, but does that get rid of the warning, or the problem?
  19. Offline


    The warning gets produced because of the crash - not the other way around.
    (And it will be cast if you for example paste a large chunk of land with worldedit that takes more than 10 seconds)
  20. Offline


    i have, however, noticed, that as soon as i took out nolagg the problem did not occour.
    i think its something with nolagg :(

    i do not have worldedit.
    i do not like greifers using server tools against me :(

  21. Offline


    You´ll have to try with only NoLagg as Plugin installed to verify that.
    Maybe deactivate most of the Nolagg functionality an test one by one to identify the problem.
    Im only using spawnlimits and chunksending - no problems on 3 Servers

    Sorry to say but then you are missing some basic knowledge of the permissionsystem
  22. Offline


    joehot2000 can you paste the stack trace it reports? And yes, the TLN feature only reports such a freeze, it does not cause it. It's basically a separate thread that sleeps every 10 seconds, combined with a tick task to mark a 'pulse'. If it finds no pulse in time, it will start generating the stack trace, trimming off the top head that is still changing.
  23. Offline


    here is all i could copy for the moment.
    i had to go to bed (i know, annoying isnt it lol :D)
    23:58:11 [WARNING] [NoLagg TLN] The main thread failed to respond after 10 seconds
    23:58:11 [WARNING] [NoLagg TLN] What follows is the stack trace of the main thread
    23:58:11 [WARNING] [NoLagg TLN] This stack trace will be further refined as long as the t
    hread is stuck
    23:58:11 [INFO] at java.lang.Throwable.fillInStackTrace(Native Method)
    23:58:11 [INFO] at java.lang.Throwable.<init>(
    23:58:11 [INFO] at java.lang.Exception.<init>(
    23:58:11 [INFO] at java.lang.RuntimeException.<init>(
    23:58:11 [INFO] at java.lang.IllegalMonitorStateException.<init>(IllegalMonitorStateE
    23:58:11 [INFO] at org.bukkit.craftbukkit.block.CraftBlockState.update(CraftBlockStat
    23:58:11 [INFO] at org.bukkit.craftbukkit.block.CraftSign.update(
    23:58:11 [INFO] at org.bukkit.craftbukkit.block.CraftBlockState.update(CraftBlockStat
    23:58:11 [INFO] at com.Acrobot.ChestShop.Listeners.Block.BlockBreak.cancellingBlockBr
    23:58:11 [INFO] at com.Acrobot.ChestShop.Listeners.Block.EntityExplode.onEntityExplod
    23:58:11 [INFO] at sun.reflect.GeneratedMethodAccessor264.invoke(Unknown Source)
    23:58:11 [INFO] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAc
    23:58:11 [INFO] at java.lang.reflect.Method.invoke(
    23:58:11 [INFO] at$1.execute(JavaPluginLoader
    23:58:11 [INFO] at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.
    23:58:11 [INFO] at org.bukkit.plugin.SimplePluginManager.fireEvent(SimplePluginManage
    23:58:11 [INFO] at org.bukkit.plugin.SimplePluginManager

    tell me if you need any more of the error, i could try and find some.
  24. Offline


    joehot2000 Strange, it shows chest stop unable to cancel the BlockBreak event properly. It ends up filling a Throwable to spawn an error, strangely enough...
  25. Offline


    Hey, fixed the SpawningBuy myself, kinda needed it so i reverse engineered the latest jar as it is not uploaded on github ;D

    One important thing:
    Bukkit has a Bug with Villager eggs. The SpawnReason is not properly set.
        public static boolean a(World world, int i, double d0, double d1, double d2) {
            if (!EntityTypes.a.containsKey(Integer.valueOf(i))) {
                return false;
            } else {
                Entity entity = EntityTypes.a(i, world);
                if (entity != null && entity instanceof EntityLiving) { // CraftBukkit
                    entity.setPositionRotation(d0, d1, d2, world.random.nextFloat() * 360.0F, 0.0F);
                    if (entity instanceof EntityVillager) {
                        EntityVillager entityvillager = (EntityVillager) entity;
                        world.addEntity(entityvillager, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG); // kade fix
                        return true;
                    world.addEntity(entity, org.bukkit.event.entity.CreatureSpawnEvent.SpawnReason.SPAWNER_EGG); // CraftBukkit
                    ((EntityLiving) entity).aH();
                return entity != null;
  26. Offline


    11:56:40 [WARNING][NoLagg TLN] The main thread failed to respond after 10 seconds
    11:56:40 [WARNING][NoLagg TLN] What follows is the stack trace of the main thread
    11:56:40 [WARNING][NoLagg TLN] This stack trace will be further refined as long as the thread is stuck
    11:56:40 [INFO]    at Method)
    11:56:40 [INFO]    at Source)
    11:56:40 [INFO]    at net.minecraft.server.RegionFile.a(SourceFile:184)
    11:56:40 [INFO]    at net.minecraft.server.RegionFileCache.c(SourceFile:91)
    11:56:40 [INFO]    at net.minecraft.server.ChunkRegionLoader.a(
    11:56:40 [INFO]    at net.minecraft.server.ChunkProviderServer.loadChunk(
    11:56:40 [INFO]    at com.bergerkiller.bukkit.nolagg.examine.TimedChunkProviderServer.loadChunk(
    11:56:40 [INFO]    at net.minecraft.server.ChunkProviderServer.getChunkAt(
    11:56:40 [INFO]    at com.bergerkiller.bukkit.nolagg.examine.TimedChunkProviderServer.getChunkAt(
    11:56:40 [INFO]    at org.bukkit.craftbukkit.CraftWorld.getChunkAt(
    11:56:40 [INFO]    at
    11:56:40 [INFO]    at com.bergerkiller.bukkit.nolagg.NoLagg.command(
    11:56:40 [INFO]    at com.bergerkiller.bukkit.common.PluginBase.onCommand(
    11:56:40 [INFO]    at org.bukkit.command.PluginCommand.execute(
    11:56:40 [INFO]    at org.bukkit.command.SimpleCommandMap.dispatch(
    11:56:40 [INFO]    at org.bukkit.craftbukkit.CraftServer.dispatchCommand(
    11:56:40 [INFO]    at net.minecraft.server.NetServerHandler.handleCommand(
    11:56:40 [INFO]    at
    11:56:40 [INFO]    at net.minecraft.server.NetServerHandler.a(
    11:56:40 [INFO]    at net.minecraft.server.Packet3Chat.handle(
    11:56:40 [INFO]    at net.minecraft.server.NetworkManager.b(
    11:56:40 [INFO]    at net.minecraft.server.NetServerHandler.d(
    11:56:40 [INFO]    at net.minecraft.server.ServerConnection.b(SourceFile:35)
    11:56:40 [INFO]    at net.minecraft.server.DedicatedServerConnection.b(SourceFile:30)
    11:56:40 [INFO]    at net.minecraft.server.MinecraftServer.q(
    11:56:40 [INFO]    at net.minecraft.server.DedicatedServer.q(
    11:56:40 [INFO]    at net.minecraft.server.MinecraftServer.p(
    11:56:40 [INFO]    at
    11:56:40 [INFO]    at
    11:56:50 [WARNING][NoLagg TLN] The main thread is still stuck, updated stack trace is:
    11:56:50 [INFO]    at com.bergerkiller.bukkit.nolagg.examine.TimedChunkProviderServer.getChunkAt(
    11:56:50 [INFO]    at org.bukkit.craftbukkit.CraftWorld.getChunkAt(
    11:56:50 [INFO]    at
    11:56:50 [INFO]    at com.bergerkiller.bukkit.nolagg.NoLagg.command(
    11:56:50 [INFO]    at com.bergerkiller.bukkit.common.PluginBase.onCommand(
    11:56:50 [INFO]    at org.bukkit.command.PluginCommand.execute(
    11:56:50 [INFO]    at org.bukkit.command.SimpleCommandMap.dispatch(
    11:56:50 [INFO]    at org.bukkit.craftbukkit.CraftServer.dispatchCommand(
    11:56:50 [INFO]    at net.minecraft.server.NetServerHandler.handleCommand(
    11:56:50 [INFO]    at
    11:56:50 [INFO]    at net.minecraft.server.NetServerHandler.a(
    11:56:50 [INFO]    at net.minecraft.server.Packet3Chat.handle(
    11:56:50 [INFO]    at net.minecraft.server.NetworkManager.b(
    11:56:50 [INFO]    at net.minecraft.server.NetServerHandler.d(
    11:56:50 [INFO]    at net.minecraft.server.ServerConnection.b(SourceFile:35)
    11:56:50 [INFO]    at net.minecraft.server.DedicatedServerConnection.b(SourceFile:30)
    11:56:50 [INFO]    at net.minecraft.server.MinecraftServer.q(
    11:56:50 [INFO]    at net.minecraft.server.DedicatedServer.q(
    11:56:50 [INFO]    at net.minecraft.server.MinecraftServer.p(
    11:56:51 [INFO]    at
    11:58:12 [WARNING][NoLagg TLN] The main thread is still stuck, updated stack trace is:
    11:58:13 [INFO]    at
    11:58:13 [INFO]    at com.bergerkiller.bukkit.nolagg.NoLagg.command(
    when running the nolagg fix command the console shows this and the server boots everyone
  27. Offline


    carls1976 The fix command does load other chunks. Do not use a radius that is too high, as it would result in a lot of chunk loads, which are rather slow.
  28. Offline


    First... Thank you so much for this plugin. Without it the server I run wouldn't be possible.

    To the point: Is there a way to limit the memory that caching items takes? (Maybe by deleting the oldest items in cache on a chunk by chunk basis or deleting data that is of a certain age?)

    Background: My server (tekkit) after a few days of running went from about 65% cpu core usage and 20ticks per second to 100% cpu usage and .5 ticks per second. In my base I got 1fps, but when I spawned randomly I got 100fps (still .5 tps)... I went back to my base and saw a mass of cobble hovering above my chest. It turns out that I misconfigured a pipe in tekkit and instead of the cobble generator sending cobble to a recycling thing it spammed on the floor at 12 cobble/second. I remembered using Nolagg in the past so I installed it and it instantly fixed the problem... the server was using 65% of a cpu core with 20tps.

    My new situation: A certain amount of time after the server restarts itself items stop dropping completely. Right now the server is using 1105 MB / 12256 MB but with one person playing it seems to be increasing by about 100MB per minute. At this rate after about two hours the memory will be full. The server restarts every 5 hours.

    Thank you so much for your hard work on a very effective plugin. If I can assist you in any way to make it even better please let me know.

    skype/steam: odielag
  29. Offline


    odielag Wow if item caching starts using a lot of memory, then something must be wrong. Items take up not even 400 bytes of data in memory, you would need several million of them to show a true effect. Maybe useful to use /lag clearall items now and then...
  30. Offline


    How can I get the total chunk count that the dynamic view distance is using? I'm running the default settings, and NL seems to be cutting down the view distance even with only a few players online.
  31. Offline


    When we use the mob cap i nthe config it stops the use of mob eggs. Please can u fix this ASAP?

Share This Page