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

    bergerkiller

    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. :)

    Important:

    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

    Description

    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.

    Read more...

    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.

    Read more...

    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. :)

    Read more...

    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.

    Read more...

    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.

    Read more...

    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.

    Read more...

    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)



    Media



    Video by brandcool86


    FAQ

    - 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.

    TODO-list:
    - Add option to disable physics when the tick delay becomes too high

    Changelog

    Show your appreciation for my plugins by donating
    [​IMG]
     
  2. Offline

    bergerkiller

    @rbos yep it could have to do with chunk caching indeed. Does the same happen if you set unloaddelay to 0?

    EDIT

    The itemhandlers automatically clean destroyed/removed items from their data list automatically, so this can't increase RAM too much. (each item would be around 4 bytes in data storage, 1 mb would require 250 items or so...)

    TnTHandler follows a list, so it will remove queued items automatically. (it processes them)
    No RAM usage if all TNT is detonated.

    Item spawn limiter: ISSUE. It spawns hidden items when the chunk is unloaded, but doesn't remove the actual chunk from memory. In other words: chunk is kept in memory (with all it's data in it) while the chunk is unloaded. Next time that chunk is loaded, a new instance is used meaning the old one is kept in RAM.

    Thanks for reporting, this could become a serious issue if used on very large worlds with lots of players. It would keep chunks in memory even if they are unloaded, rapidly increasing RAM, basically polluting the computer space. I got it fixed now.

    EDIT2

    Updated it, @rbos feel free to test it again. I hope I found the main cause...
     
  3. Offline

    rbos

    With the new version, memory still seems to be creeping up a little, but it's probably too early to tell for sure. With 12 players, per-user memory use is on average going up.

    2011-09-24 08:23:57 [INFO] [MemMonitor]Memory per Player 55 MB
    2011-09-24 08:26:06 [INFO] [MemMonitor]Memory per Player 75 MB
    2011-09-24 08:28:06 [INFO] [MemMonitor]Memory per Player 73 MB
    2011-09-24 08:29:53 [INFO] [MemMonitor]Memory per Player 74 MB
    2011-09-24 08:32:00 [INFO] [MemMonitor]Memory per Player 87 MB
    2011-09-24 08:35:22 [INFO] [MemMonitor]Memory per Player 94 MB
    2011-09-24 08:39:19 [INFO] [MemMonitor]Memory per Player 67 MB
    2011-09-24 08:45:04 [INFO] [MemMonitor]Memory per Player 79 MB
    2011-09-24 08:50:36 [INFO] [MemMonitor]Memory per Player 81 MB
    2011-09-24 08:55:51 [INFO] [MemMonitor]Memory per Player 72 MB
    2011-09-24 09:00:20 [INFO] [MemMonitor]Memory per Player 76 MB
    2011-09-24 09:05:14 [INFO] [MemMonitor]Memory per Player 77 MB
    2011-09-24 09:09:45 [INFO] [MemMonitor]Memory per Player 81 MB
    2011-09-24 09:14:20 [INFO] [MemMonitor]Memory per Player 92 MB
    2011-09-24 09:18:41 [INFO] [MemMonitor]Memory per Player 99 MB
    2011-09-24 09:23:26 [INFO] [MemMonitor]Memory per Player 93 MB
    2011-09-24 09:28:55 [INFO] [MemMonitor]Memory per Player 106 MB
    2011-09-24 09:33:15 [INFO] [MemMonitor]Memory per Player 132 MB
    2011-09-24 09:38:00 [INFO] [MemMonitor]Memory per Player 134 MB

    I'll keep monitoring it.

    Okay, I'm at 15 players, and memory usage is sitting between ~140-150mb per player. Fingers crossed. It's significantly higher than the 70-90 I expect without chunk caching though.

    Edit: Ten minutes later, it crossed 165 per player, dropping the server memory free total below 200 and triggering my auto-restart script.

    I'll try turning off chunk caching.

    Got this when shutting down, too:

    2011-09-24 10:49:14 [SEVERE] Error occurred while disabling NoLagg v1.17 (Is it up to date?): null
    java.util.ConcurrentModificationException
    at java.util.HashMap$HashIterator.nextEntry(Unknown Source)
    at java.util.HashMap$KeyIterator.next(Unknown Source)
    at com.bergerkiller.bukkit.nolagg.ItemHandler.unloadAll(ItemHandler.java:70)
    at com.bergerkiller.bukkit.nolagg.NoLagg.onDisable(NoLagg.java:114)
    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:128)
    at org.bukkit.plugin.java.JavaPluginLoader.disablePlugin(JavaPluginLoader.java:941)
    at org.bukkit.plugin.SimplePluginManager.disablePlugin(SimplePluginManager.java:294)
    at org.bukkit.plugin.SimplePluginManager.disablePlugins(SimplePluginManager.java:287)
    at org.bukkit.craftbukkit.CraftServer.disablePlugins(CraftServer.java:168)
    at net.minecraft.server.MinecraftServer.stop(MinecraftServer.java:325)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:404)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:417)

    Set cache delay to 0, same problem. Trying without NoLagg just in case something changed.

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: May 19, 2016
  4. Offline

    Samovar

    This plugin automaticaly change mob spawn rate. On my server with difficulty 3 noone can find mobs. Befor i install this plugin server was ocupated with agressive mobs. And this situation come back after i uninstalled this plugin.

    I did just use default configuration so mobs should spawn as allways.

    This bug should be fixed.
     
  5. Offline

    Michael_Lee

    This plugin is absolutely fantastic! Queues up TNT explosions, preventing both server lag and clientside lag. Great work!
     
  6. this conflicts with bleeding mobs, lets you pick up the redstone, bones, and red wool that you ussually can't
     
  7. Offline

    Adrenaline

    Same:

    PHP:
    2011-09-25 00:15:44 [SEVEREError occurred while disabling NoLagg v1.17 (Is it up to date?): null
    java
    .util.ConcurrentModificationException
        at java
    .util.HashMap$HashIterator.nextEntry(HashMap.java:806)
        
    at java.util.HashMap$KeyIterator.next(HashMap.java:841)
        
    at com.bergerkiller.bukkit.nolagg.ItemHandler.unloadAll(ItemHandler.java:70)
        
    at com.bergerkiller.bukkit.nolagg.NoLagg.onDisable(NoLagg.java:114)
        
    at org.bukkit.plugin.java.JavaPlugin.setEnabled(JavaPlugin.java:128)
        
    at org.bukkit.plugin.java.JavaPluginLoader.disablePlugin(JavaPluginLoader.java:941)
        
    at org.bukkit.plugin.SimplePluginManager.disablePlugin(SimplePluginManager.java:294)
        
    at org.bukkit.plugin.SimplePluginManager.disablePlugins(SimplePluginManager.java:287)
        
    at org.bukkit.craftbukkit.CraftServer.disablePlugins(CraftServer.java:168)
        
    at net.minecraft.server.MinecraftServer.stop(MinecraftServer.java:325)
        
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:404)
        
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:417)
     
  8. Offline

    Caid

    So you're saying there's no actual way to control overall spawn rate? If I wanted, say, 1/10th of the normal amount of monsters spawned at a given time, it'll just put all the extra overall entities into something that isn't controlled?
     
  9. Offline

    bergerkiller

    @Caid then you need to set limits for all monsters individually. Due to the system used I can't easily set limits for animals, monsters or mobs, since those are different 'EntityLimiter' instances.
     
  10. Offline

    Caid

    If I set them all to 20 each, is that 20 serverwide? No formula or anything that has multiplication or division, right?
     
  11. Offline

    bergerkiller

    @Caid nope, that would be 20 for every world. So if you run 10 worlds (and use the default) you could set it to 2.
     
  12. Offline

    kahlilnc

    If I had
    spider: 0
    skeleton: 0
    creeper: 0
    would that actually remove it from the server? I really want to replace that with whichmob the plugin.
     
  13. Offline

    wolfgangab3

    I found a duplication bug caused by this plugin. It occurs when AutoStackForming is on and....I dont really want to say anymore as it can be exploited easily. I will demonstrate for the plugin author or anyone willing to submit and fix. It is urget to get this fixed ASAP
     
  14. Offline

    bergerkiller

    @wolfgangab3 You can always PM me of how to reproduce it if you don't want it to become publicly visible. I thought I fixed all duplication bugs when updating to 1.14, but ow well.

    @kahlilnc Yep, if you use that like this in the config.yml:
    Code:
    spawnlimits:
        default:
            spider: 0
            skeleton: 0
            creeper: 0
    Spiders, skeletons and creepers will no longer spawn on your server. Do note that this also influences spawn commands performed by other plugins (/spawnmob for example)
     
    kahlilnc likes this.
  15. Offline

    Kademlia

    Hey, thanks for the update. Running smoothly again.

    Do you know if you can somehow allow mobArena spawning mobs even if the spawnlimit was hit?

    The mobs spawn and disappear instantly making it unplayable.

    I really need the limiter trough as i got about 30-50 players online and about 1500 mobs spawning for them. Kind of an overkill for the server with the crappy performance of 1.8 :(
     
  16. Offline

    bergerkiller

    Can't think of a solution for now, since it performs a global cleanup task besides handling the commands...
    I could try to exclude custom-spawned entities from the update list...but that would still allow /spawnmob to crash the server.
     
  17. Offline

    fffizzz

    im getting this too with 117, cb 1214
     
  18. Offline

    Kademlia

    Okay second thing i just found:

    If i let a TNT explode, BigBrother does NOT log the Environment event of block destruction around the TNT detonation.

    Whit out NoLagg this works fine :(


    By spawning too many? Or in some bad-programming way?
     
  19. Offline

    aonbyte

    Hi I love the plugin as it greatly assists in the handling of experience orbs. However, I think there is a slight memory leak issue. I don't know...maybe I'm wrong but are chunks usually supposed to remain loaded after a really long time? I have about 9 players on, all within a 2000 block radius. Some are close together in groups.

    These are some screenshots:
    [​IMG]


    [​IMG]

    Is this a memory leak issue?

    Craftbukkit #1185
    NoLagg 1.17

    EDIT: I want to add that no matter how many players log on...The amount of chunks loaded always rises with NoLagg enabled. I recently just disabled NoLagg and the amount of chunks stopped rising at the rate it was rises and eventually after a few minutes started dropping.
     
  20. Offline

    mineHAVOC

    im trying to find a memory leak also on my server, and noticed that since installing this 2 days ago, my chunks seem to do that also. ive disabled all plugins except for 4 plugins. This, towny and Worldguard/worldedit. and memory still gets eatin up. I didnt have a memory leak problem before installing this plugin.

    same versions as above poster\


    edit: also getting shutdown error
     
  21. Offline

    bergerkiller

    I noticed the shutdown error before, not really an issue when disabling though (as far I can tell everything got closed/saved at that point). I am more concerned about the missing event handling for explosions (it should just work?). No idea where a memory leak exists...I checked all possible locations where a chunk is stored if it got properly removed.

    Also, do you frequently load/unload worlds? Because in the latest Craftbukkit versions the world unload event is failing.
     
  22. Offline

    Aeron

    Looks very nice and works well for now. Thanks for the plugin!
     
  23. Offline

    aonbyte

    I don't think I frequently load or unload worlds as I only have one main world along with the nether world.
     
  24. Offline

    cartman-2000

    Yes, I saw something like this too, can cause items to be nearly doubled in some situations.

    And chunks slowly unload for me and only on Marksweep GC, if you use a somewhat more aggressive GC then the default then chunks may unload faster.
     
  25. Offline

    Samovar

    I think this plugin just overwrite server.properties difficulty to 1 (easy) which is default value.
    Can you fix it or at last test it.
     
  26. Offline

    bergerkiller

    @Samovar it doesn't change the setting, instead it holds worldname / spawnedcount pairs for worlds, where spawnedcount are the limits for every entity, and the count to manage. If nothing is set it should not influence spawn rates whatsoever.
     
  27. Offline

    cartman-2000

    It is leaking memory, in the form of chunks still loaded after a long time by the looks of it.

    Output from world guard on them when my server is close to running out of memory in a 12 hour span.

    Code:
    ------
    Worlds
    ------
    world (0)            :
        Information:
            Seed              : 4681951721420010592
            Environment      : NORMAL
            Player count      : 2
            Entity count      : 533
            Loaded chunk count: 3914
            Spawn location    : Location{world=CraftWorld{name=world},x=114.0,y=64.0,z=71.0,pitch=0.0,yaw=0.0}
            Raw time          : 238266045
        Entities  :
            CraftPig        : 29 [0.007409]
            CraftMinecart  : 13 [0.003321]
            CraftCow        : 36 [0.009198]
            CraftChicken    : 44 [0.011242]
            CraftSheep      : 42 [0.010731]
            CraftItem      : 310 [0.079203]
            CraftSquid      : 23 [0.005876]
            CraftBoat      : 2 [0.000511]
            CraftWolf      : 9 [0.002299]
            CraftPainting  : 23 [0.005876]
            SpoutCraftPlayer: 2 [0.000511]
    world_nether (1)    :
        Information:
            Seed              : -2877999723214052179
            Environment      : NETHER
            Player count      : 0
            Entity count      : 21
            Loaded chunk count: 669
            Spawn location    : Location{world=CraftWorld{name=world_nether},x=115.0,y=61.0,z=73.0,pitch=0.0,yaw=0.0}
            Raw time          : 323948477
        Entities  :
            CraftPigZombie: 3 [0.004484]
            CraftItem    : 18 [0.026906]
    cartsworld (2)      :
        Information:
            Seed              : 4096239146159493236
            Environment      : NORMAL
            Player count      : 3
            Entity count      : 1168
            Loaded chunk count: 6273
            Spawn location    : Location{world=CraftWorld{name=cartsworld},x=7.0,y=71.0,z=-39.0,pitch=0.0,yaw=0.0}
            Raw time          : 243993681
        Entities  :
            CraftArrow        : 2 [0.000319]
            CraftExperienceOrb: 5 [0.000797]
            CraftChicken      : 102 [0.016260]
            CraftZombie      : 86 [0.013710]
            CraftBoat        : 1 [0.000159]
            CraftPainting    : 12 [0.001913]
            CraftSkeleton    : 65 [0.010362]
            CraftEnderman    : 9 [0.001435]
            CraftPig          : 141 [0.022477]
            CraftCreeper      : 78 [0.012434]
            CraftCow          : 110 [0.017535]
            CraftMinecart    : 1 [0.000159]
            CraftSheep        : 347 [0.055316]
            CraftItem        : 182 [0.029013]
            CraftSquid        : 17 [0.002710]
            CraftSpider      : 7 [0.001116]
            SpoutCraftPlayer  : 3 [0.000478]
    cartsworld_nether (3):
        Information:
            Seed              : 6851522894659225054
            Environment      : NETHER
            Player count      : 0
            Entity count      : 126
            Loaded chunk count: 427
            Spawn location    : Location{world=CraftWorld{name=cartsworld_nether},x=0.0,y=64.0,z=0.0,pitch=0.0,yaw=0.0}
            Raw time          : 142434037
        Entities  :
            CraftPigZombie: 78 [0.182670]
            CraftGhast    : 1 [0.002342]
            CraftItem    : 47 [0.110070]
    skylands (4)        :
        Information:
            Seed              : 2840070339964834510
            Environment      : SKYLANDS
            Player count      : 0
            Entity count      : 46
            Loaded chunk count: 642
            Spawn location    : Location{world=CraftWorld{name=skylands},x=-36.0,y=56.0,z=-180.0,pitch=0.0,yaw=0.0}
            Raw time          : 188606317
        Entities  :
            CraftMinecart: 2 [0.003115]
            CraftChicken : 25 [0.038941]
            CraftItem    : 18 [0.028037]
            CraftPainting: 1 [0.001558]

    Also looking at the code, this doesn't look right. Isn't there supposed to be a greater than not a less than in this? By this it looks like chunk unload will always be canceled if it is older then "chunk load time + chunk unload delay".


    Code:
                if (time + chunkUnloadDelay < System.currentTimeMillis()) {
                    event.setCancelled(true);
                } else {
                    chunks.remove(event.getChunk());
                }
     
  28. Offline

    bergerkiller

    @cartman-2000 Well spotted yes. My guess is that, during the 1.73 - 1.8 transition, chunks are no longer unloaded after the first one is cancelled. These lines:
    Prove this point. For now set the chunkUnloadDelay to 0 to solve the leak. I'll add a manual chunk unload task in there to make sure chunks are unloaded when they have to.
     
  29. Offline

    emericask8ur

    When are you gonna help me on that thing -__________-
     
  30. Offline

    bergerkiller

    @emericask8ur Stop hijacking threads sk8ur, if you need to ask stuff do it on Skype. (yes, dev mode is now on, but still busy)
     
    emericask8ur likes this.
  31. Offline

    godsarmy9797

    Your Plugins.....THEY AMAZE ME. Keep up the good work!!
     

Share This Page