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


    winking Disable the features you don't need or don't want running. And yes, the chunk sending is currently a bit lacking, as it is not efficient enough. (too much CPU power is used to compress all these chunks, and then the chunks are sent too fast, causing a higher network usage. Will fix all of that when I have time, for the time being, you can disable the chunk sender OR set the sendThreadCount to 0 to not use additional threads.
  3. Offline


    bergerkiller Any ETA on when we can expect a fix? Take your time though, I know you are busy.
  4. Offline


    rtcabooservb I'll work on a fix this afternoon (in 4 hours), at school right now. Won't take too long to fix, but will require a longer time to debug it.
  5. Offline


    Awesome, can't wait.
  6. Offline


    I still get this error when I have chunk sending enabled. Also get lots of screwed up chunks:

    EDIT: actually it happens whether it is enabled or not, and after I uninstall the plugin. It has to be this plugin because it only begins to happen when I add or remove this plugin.
  7. Offline


    jjon43 mmh that is a very bad sign, some chunk data got swapped around again. What other plugins do you use? And what version of NoLagg did you use?
  8. Offline


    The latest dev build of nolagg (like, whatever the latest was in the last hour) and [​IMG]. Those are the plugins that I currently use, minus Orebfuscator. I'm just trying to get that to work, but when the errors came up on my test server, it wasn't installed. Sorry, feeling very lazy and don't want to crop. :p

    I don't know, when I disable it, it works. What plugin could it be then? I uninstalled Orebfuscator before I tested it, and also uninstalled Spout and anything related to spout (like Vanishnopacket). Also, does that mean that you are going to not allow the use of this plugin with Spout at all?

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


    jjon43 Are you using Spout? Someone told me that a recent Spout version caused all stone blocks to turn into air (this is what I've seen as well).
  10. Offline


    Yes, but this problem only happens when NoLagg is installed. I haven't had any problems with Spout.
  11. Offline


    jjon43 Nevertheless, what Spout version do you use right now? (does it happen with the newest version as well, if you don't use the newest yet?) I'll download the latest Spout build to test against. I had an idea where this issue was coming from, but never managed to actually proof it.
  12. Offline


    Oh, well i was using something in the higher 600's, but let me try the new 701 build with nolagg.

    I just checked, it was version 696.

    EDIT: Nope, still happens with build 701 of spout. Let me try it without spout...

    Ok, just tested it without spout, and it works without chunk sending, but when I turn it on, the world gets corrupted again. It's spout build 701 and NoLagg whatever is the latest on BukkitDev.

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


    jjon43 ooow hold on.
    Chunk sending is not related to the physical chunk in any way. You obviously have a plugin running that is temporarily storing the packet data, and that is a complete dead trap for NoLagg. Also, chunk sending can not cause physical chunk corruption, since it doesn't alter the chunk, write to it or other. Therefore anything you notice will be related to the packet that got corrupted.

    The latest build of Ore Obfuscator is a plugin that causes this. I added multi-threading to prevent the tick lag, but the author decided to add one himself as well. That made it impossible for me to buffer packet data as intended. In the next version I quit supporting the Spout packet listener, it is far too dangerous for what I want to achieve.

    jjon43 Mmh It's not impossible to fix that issue, I'll see what I can do.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: Oct 10, 2018
  14. Offline


    Ok, I'm just trying to help out.
  15. Offline


    I have an issue where overworld chunks are stored in the nether. No errors that I know of.

    1.58 running CB 1770.
  16. Offline


    Fishfish0001 are these chunks permanent or not? (does re-joining fix this issue?)

    Also, already prepped up a newer version which is a lot better. Even with one thread it outperforms native coding.

    Ok finally updated to 1.58.1. This fixes the overflow errors, heavily reduces the sending lag occurring previously and, above all that, prevents 'transparent chunks' from happening. I previously had to schedule this, but that failed 80% of the time. With the new (high priority) sending system, it is guaranteed to show chunks properly.

    For some reason this also boosts rendering speeds at the clients, they render the chunks a lot faster now. Don't ask me why, but a block change packet appears to work in strange ways :)

    Also added a bit of compatibility for Spout plugins storing packets. If the event is cancelled, it will clone the raw data, just in case the plugin stored it previously. Note that this can cause the RAM memory to increase rapidly, but it's out of my control unfortunately.

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


    [SEVERE] [NoLagg] Failed to send map chunk [-13, 15] to player Test
    2012-01-21 00:36:50 [SEVERE] java.lang.NoSuchFieldError: buffer
    2012-01-21 00:36:50 [SEVERE]    at com.bergerkiller.bukkit.nolagg.sending.BufferedPacket51MapChunk.<init>(
    2012-01-21 00:36:50 [SEVERE]    at com.bergerkiller.bukkit.nolagg.sending.ChunkCompressionThread.getCompressedPacket(
    2012-01-21 00:36:50 [SEVERE]    at
    spaming that in console, server freezes
  18. Offline


    bergerkiller With the latest update, chunks are loading way too slow.
    Edit: Had to disable chunk sending in nolagg and turn thread compressions to 0.
  19. Offline


    rtcabooservb *confused* can I see the configuration you used? Also, while in 'slow mode' go in-game and monitor yourself (/nolagg monitor) - what is the sending rate? And what is the packet load %?

    (if possible, could I join the server and check it out for myself? Chunks load incredibly fast on my server, and outsiders that join experience the same...)

    Averus you need to use the latest CraftBukkit build.
    Averus likes this.
  20. Offline


    Tried the new version, works fine. Of course, RAM usage has nontupled, which poses a bit of a problem for me, due to only one gigabyte of RAM available for use by the server.

    Are there any reasons for this? And how many resources does a thread for chunk take; any effect of having multiple?
  21. Offline


    sagethor well actually, I reduced RAM usage in the past few versions. Instead of storing 80 kb of 'raw' data for every sent packet temporarily, it now stores a mere 8 kb per chunk. (and this 8 kb was stored previously as well).

    The 'raw data' is no longer in the packet: it is in the compression threads. Each thread comes with a separate deflator, raw data buffer and output data buffer. This means that every chunk compression thread takes up 160 kb of data.

    However, if you use Spout and another plugin cancels sending the chunk, the raw data is cloned. This is done just in case the plugin that cancelled the event stored the packet internally. (which poses a risk if the raw data is re-used)

    So, if you use Ore obfuscator, you'll probably encounter a higher memory usage. This is caused by Ore obfuscator, since it:
    1. Clones the raw data
    2. Cancels the event
    3. Stores packets temporarily
    4. Causes NoLagg to clone the packet data to fight packet corruption
    3 clones for every packet, which can become quite a difference. Maybe if the author of ore obfuscator allows me to implement the coding in NoLagg (or a separate plugin) I can prevent all this. It will then use up a lot less memory.
  22. Offline


    Which AntiXray would you recommend me to use while I'm using nolagg?

  23. Offline


    I don't use Ore Obfuscator, though... that's what's puzzling me.

    EDIT - Plugins used:
    BedRespawn, EntitySuppressor, FlatEarth, iConomy, Lava Forge, Lockette, Minequery, MusicCraft, rTriggers, ServerLogSaver, SimpleModerator, Vault, Votifier, ButtonWarp, ColorMe, mcMMO, My Worlds, PermissionsBukkit, PreciousStones and ShowCaseStandalone.

    I have one compression thread running, which appears to have shaved off a few megabytes of RAM usage from the default two.
  24. Offline


  25. Offline


    PcPocket you could use the Obfuscator plugin (mentioned before), but use the version BEFORE the multithreading got introduced there. Instead you can use NoLagg's chunk send thread count to adjust this.

    sagethor Hmmm what is the chunk memory usage then? I can't tell where the issue lies unfortunately, as it could be both related to chunk loading, generating and conversion to compressed packets...
  26. Offline


    The server currently uses 762 MB idling, posted more details in above edited post.

    Weirdly enough though, it seems like the computer itself is using the same amount of memory as before when memory measurements were below 100 MB on the server. I still have 1GB being used out of 2GB; seems to be no change.

    Perhaps there's an issue with the memory reader?
  27. Offline


  28. Offline


    sagethor the memory output you see on the computer (task manager?) is the amount of memory the OS decided to give that Java process. It is always more than what is actually used, the amount that is needed is a decision made by the OS.

    PcPocket Chunk manager is supported by NoLagg and you are free to use it of course. You may want to disable chunk sending in NoLagg though, or it will output a warning. The main difference between Thulinma's approach and mine is that I litterally take over everything, including packet compression and even managing the buffer size of the player to prevent overflow disconnections or massive delays. His is more basic and uses a scheduled task to manually send the chunks at a steady rate.

    I am not sure of AntiXRay (I don't know what implementation is used there), you can try, but it's possible that it will fail if NoLagg's sending is enabled. (it re-uses raw data and only spout packet listeners get to manage this raw data)
  29. Offline


    Yes, but 762 MB is what /nolagg monitor shows, is what I'm trying to say.
  30. Offline


    # Sets if and how many items are buffered per chunk
    bufferItems: true
    maxItemsPerChunk: 40
    bufferTNT: true
    tntDetonationInterval: 1
    tntDetonationRate: 10
    explosionRate: 5
    useSpawnLimits: true
        mob: 2500
      global: {}
      worlds: {}
    useChunkUnloadDelay: true
    chunkUnloadDelay: 10000
    formItemStacks: true
    stackRadius: 1.0
    stackThreshold: 2
    autoSaveInterval: 400
    updateInterval: 20
    monitorInterval: 40
    autoFixLighting: false
    useBufferedChunkLoading: true
      enabled: true
      minRate: 0.25
      maxRate: 2.0
      boost: 25
      sendThreadCount: 2
    If you want to come and test, the IP is I'll promote you to member so you can bypass the quiz. I enabled thread count and chunk sending so you can come check yourself. It says packet load -900.0%, 20 TPS, 0% busy, and 0.1MS/tick.

    Edit: Chunk sending: 100% of 441 at 2.0 chunks/tick (2.0 avg)
  31. Offline


    sagethor and that value is too high? Or too low? Not sure what is wrong with 762 MB though.

    Ow ... wait
    I did change totalMemory to maxMemory at request, and since I now subtract max with free instead of total with free...the new value is higher than it is supposed to be. Hang on, I'll fix up a re-upload real soon.

Share This Page