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

    o0AzzA0o

    it works ok if you combine it with another tool that saves chunks every so often.. both my servers are running fine with nolagg + spout but im not using nolagg chunks and i turn off chunk unload delay
     
  3. Offline

    bergerkiller

    @o0AzzA0o good point, if you disable chunk unload delays chunks will save normally when unloaded. No problem then either. :)
     
  4. Offline

    Smex

    The HashMap Exception also occours when the ChunkDelaying stuff is false.
    Code:
    2011-11-24 22:37:17 [SEVERE] java.util.ConcurrentModificationException
    2011-11-24 22:37:17 [SEVERE]     at java.util.HashMap$HashIterator.nextEntry(HashMap.java:806)
    2011-11-24 22:37:17 [SEVERE]     at java.util.HashMap$KeyIterator.next(HashMap.java:841)
    2011-11-24 22:37:17 [SEVERE]     at net.minecraft.server.World.a(World.java:2334)
    2011-11-24 22:37:17 [SEVERE]     at net.minecraft.server.ChunkLoader.a(SourceFile:140)
    2011-11-24 22:37:17 [SEVERE]     at net.minecraft.server.ChunkRegionLoader.a(SourceFile:84)
    2011-11-24 22:37:17 [SEVERE]     at net.minecraft.server.ChunkProviderServer.saveChunk(ChunkProviderServer.java:152)
    2011-11-24 22:37:17 [SEVERE]     at com.bergerkiller.bukkit.nolagg.ChunkOperation.saveChunk(ChunkOperation.java:155)
    2011-11-24 22:37:17 [SEVERE]     at com.bergerkiller.bukkit.nolagg.ChunkOperation.execute(ChunkOperation.java:147)
    2011-11-24 22:37:17 [SEVERE]     at com.bergerkiller.bukkit.nolagg.ChunkScheduler.run(ChunkScheduler.java:137)
    PHP:
    bufferItemstrue
    bufferTNT
    true
    useSpawnLimits
    false
    useChunkUnloadDelay
    false
    tntDetonationInterval
    1
    tntDetonationRate
    10
    explosionRate
    5
    maxItemsPerChunk
    40
    formItemStacks
    true
    chunkUnloadDelay
    10000
    autoSaveInterval
    400
    updateInterval
    20
    stackRadius
    1.0
    stackThreshold
    2
    monitorInterval
    40
     
  5. Offline

    Borch

    OK first of all, sorry for being a lazy prick and ask you all of these questions instead of looking at the server code myself:
    I'm curious on what the exact changes with the save system are in 1.0.
    1. What exactly are the tick lists used for? I've seen some ticklist stuff in the server before, but never bothered investigating what they do.
    2. Does the Minecraft 1.0 server save chunks in an async fashion now? What about loading? I assume that even terrain generation happens in an async fashion now, and that this synchronization is broken. (See here)

    Another question about your recent statement that async scheduler tasks aren't really async: Is that really true? I had this feeling once when I was working with tasks that would take a long time to execute. I quickly checked if they would accidentally run in the main thread, but that wasn't the case. Do you have any explanation for these issues?

    Sorry for abusing the thread, I hope you don't mind. Eagerly awaiting 1.0RB + NoLagg update :)
     
  6. Offline

    bergerkiller

    @Smex also set the auto save interval to a value < 400.

    @Borch

    1. Tick lists are like smaller scheduled tasks. They are used for redstone mostly, in 1.0 these tick lists are saved to make redstone clocks etc. continue even after the world was unloaded. Saw a request for this a while ago, frankly it got added.

    2. Async saving is made impossible in this update, so I'm sure this is not the case. It is basically using something managed on the main thread when saving (the tick list). It could be possible that Chunk generation is async, but I don't really handle it other than scheduling some smaller chunk fixes afterwards.

    The async tasks have the nasty downside, which is that they spam an error when disabling, one major reason to stop using it. Other than that, I wanted to use the smaller gap (50 ms avg) in between ticks to perform some valuable chunk packet compression.

    Also, on a sidenote, until Spout is update it is 100% safe to use NoLaggChunks. AFAIK no packet coding got turned around, otherwise I'll soon notice this once Spout is updated.

    This is where my code is currently breaking and causing that error
     
  7. Offline

    Smex

    @bergerkiller
    Good, the exception with the hashmap is fixed but now I have a new issue.
    I spawned a big tnt block, like 20x20x60, on the explosions, I got a new exception.
    I am using a dev-build for Minecraft 1.0.
    Code:
    2011-11-25 09:06:25 [SEVERE] [NoLagg] Failed to spawn block drops during explosions!
    2011-11-25 09:06:25 [SEVERE] java.lang.NoSuchMethodError: net.minecraft.server.Block.dropNaturally(Lnet/minecraft/server/World;IIIIF)V
    2011-11-25 09:06:25 [SEVERE]     at com.bergerkiller.bukkit.nolagg.TnTHandler.createExplosion(TnTHandler.java:145)
    2011-11-25 09:06:25 [SEVERE]     at com.bergerkiller.bukkit.nolagg.TnTHandler.createExplosion(TnTHandler.java:117)
    2011-11-25 09:06:25 [SEVERE]     at com.bergerkiller.bukkit.nolagg.NLEntityListener.onEntityExplode(NLEntityListener.java:38)
    2011-11-25 09:06:25 [SEVERE]     at org.bukkit.plugin.java.JavaPluginLoader$66.execute(JavaPluginLoader.java:721)
    2011-11-25 09:06:25 [SEVERE]     at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:58)
    2011-11-25 09:06:25 [SEVERE]     at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:339)
    2011-11-25 09:06:25 [SEVERE]     at net.minecraft.server.Explosion.a(Explosion.java:181)
    2011-11-25 09:06:25 [SEVERE]     at net.minecraft.server.World.createExplosion(World.java:1522)
    2011-11-25 09:06:25 [SEVERE]     at net.minecraft.server.WorldServer.createExplosion(WorldServer.java:215)
    2011-11-25 09:06:25 [SEVERE]     at net.minecraft.server.EntityTNTPrimed.explode(EntityTNTPrimed.java:88)
    2011-11-25 09:06:25 [SEVERE]     at net.minecraft.server.EntityTNTPrimed.w_(EntityTNTPrimed.java:66)
    2011-11-25 09:06:25 [SEVERE]     at net.minecraft.server.World.entityJoinedWorld(World.java:1251)
    2011-11-25 09:06:25 [SEVERE]     at net.minecraft.server.WorldServer.entityJoinedWorld(WorldServer.java:104)
    2011-11-25 09:06:25 [SEVERE]     at net.minecraft.server.World.playerJoinedWorld(World.java:1233)
    2011-11-25 09:06:25 [SEVERE]     at net.minecraft.server.World.tickEntities(World.java:1140)
    2011-11-25 09:06:25 [SEVERE]     at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:507)
    2011-11-25 09:06:25 [SEVERE]     at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:414)
    2011-11-25 09:06:25 [SEVERE]     at net.minecraft.server.ThreadServerApplication.run(SourceFile:457)
     
  8. Offline

    bergerkiller

    @Smex yeah that's a known incompatibility for 1.00. The function name changed from 1.81 to 1.00, I'll have to wait for 1.oo to be official to change it. (I can't make it compatible for both versions, since Java eclipse doesn't allow me to)

    Ok first step for compatibility for 1.00 is done:
    Code:
            File worldfolder = ((CraftServer) Bukkit.getServer()).getWorldContainer();
            IDataManager datmanager = new ServerNBTManager(worldfolder, "dummy", true);
            dummyWorld = new WorldServer(null, datmanager, "dummy", 1, new WorldSettings(0, 0, true), Environment.NORMAL, null);
    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Jul 14, 2016
  9. Please upload the update
     
  10. Offline

    rtcabooservb

    Any ETA for the update to work with 1.0?
     
  11. Offline

    bergerkiller

    @rtcabooservb A few days I guess. Could also be a few hours, totally depends how easy it is to go from world, to worldproviderserver, to chunkloader, to custom world argument. Now trying out something with reflection to get the chunkloader from a worldproviderserver. If that works out, then I'm really happy :)
     
  12. I think 1 or 2 years :p
     
  13. Offline

    rtcabooservb

    Well, best of luck to you then. I'll be anxiously waiting for your update and spout's update on the dev site.
     
  14. AND ME AND ME I CANT WAIT :p
     
  15. Offline

    bergerkiller

    Progress:
    Code:
        private static WorldServer dummyWorld;
        private static Field chunkloader;
        private static Field ticklist;
    
        @SuppressWarnings({"unchecked", "rawtypes"})
        public static Set getClonedTickList(WorldServer from) {
            try {
                Set source = (Set) ticklist.get(from);
                Set rval = new HashSet(source.size());
                rval.addAll(source);
                return rval;
            } catch (Exception e) {
                return null;
            }
        }
        public static void saveChunk(Chunk chunk) {
            try {
                //prepare dummy
                dummyWorld.setTime(chunk.world.getTime());
                //dummyWorld
                IChunkLoader loader = (IChunkLoader) chunkloader.get(((WorldServer) chunk.world).chunkProviderServer);
    
                loader.a(dummyWorld, chunk);
            } catch (Exception e) {
                NoLagg.log(Level.WARNING, "Failed to unload chunk " + ChunkHandler.toString(chunk) + ":");
                e.printStackTrace();
            }
            //deinit dummy world
            //dummyWorld.tic
        }
    
        public static void init() {
            try {
                //Generate dummy world clone from already made world
                dummyWorld = ChunkHandler.getNative(Bukkit.getServer().getWorlds().get(0));
                IDataManager datmanager = dummyWorld.q();
                dummyWorld = new WorldServer(null, datmanager, "dummy", 1, new WorldSettings(0, 0, true, false), Environment.NORMAL, null);
                chunkloader = ChunkProviderServer.class.getDeclaredField("e");
                ticklist = WorldServer.class.getDeclaredField("L");
                enabled = true;
                thread = new ChunkScheduler();
                thread.start();
            } catch (Exception e) {
                NoLagg.log(Level.SEVERE, "Failed to initialize async chunk saving implementation:");
                e.printStackTrace();
                enabled = false;
            }
        }
     
    o0AzzA0o likes this.
  16. Offline

    jjon43

    ^^ No idea what that says, but I'm assuming it's progress?
     
  17. Offline

    bergerkiller

    @jjon43 sure is! Now managed to make my own dummy world (it's no where referenced on the main thread), which I can now use as a bridge. Complete class for it has been made, with fail-safe protection around it to keep NoLagg running even if field names get changed.

    Now time for some thorough test runs...
     
  18. I LOVE YOU AND YOUR PLUGIN IS ESSENCIAL FOR A SERVER :p
     
  19. Offline

    bergerkiller

    Note that I will only update NoLagg.jar for 1.00. Can't update NoLaggChunks (completely) because there is no Spout for 1.00. NoLagg is working (at least, it seems so here with the latest build)

    Haven't noticed anything odd.

    Ok uploaded NoLagg for bukkit server 1.0.0. Chunk saving issues have all been resolved and I added so many safety checks that, even if it fails, it will not bring the entire plugin down. Note that the 1.00 build is NOT for cb 1337, using it for 1.81 will probably fail in ways you can't imagine.

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

    o0AzzA0o

    Thanks for updating this plugin ahead of time :)
     
  21. Offline

    rtcabooservb

    Is it just nolaggs or did you update nolaggschunks too? Spout did have an update on the dev site.
     
  22. Offline

    kingdavidd

    there is actually a spout go to http://ci.getspout.org/job/Spout/
     
  23. Offline

    bergerkiller

    @rtcabooservb ow then they just updated it. I'll update NoLaggChunks too, hang on...
     
  24. The new update dont give me any problem in my server THANKS FOR ALL
     
  25. Offline

    bergerkiller

    All done, NoLaggChunks is now in the 1.00 download as well. Tested against the latest Spout build.
     
  26. Offline

    o0AzzA0o

    All seems to be working nice thanks
     
  27. Offline

    Sp0ng3b0b

    Could you please release an update for the latest dev bukkit ?
     
  28. The last build works fine with lastest CB dev-build
     
  29. Offline

    Sepulzera

    CB#1509 + most recent nolagg version will still cause the tnt bug (it explodes at the bedrock layer instead of the surface)
     
  30. Offline

    bergerkiller

    @Sepulzera ok then then the new CB build did not fix it. I'll look into it again once I got time...
     
  31. Offline

    kalez

    I get this sometimes while /reload-ing:

    2011-11-26 19:10:18 [SEVERE] [NoLagg] An error occured while performing a routine update:
    2011-11-26 19:10:18 [SEVERE] java.util.ConcurrentModificationException
    2011-11-26 19:10:18 [SEVERE] at java.util.ArrayList$Itr.checkForComodification(Unknown Source)
    2011-11-26 19:10:18 [SEVERE] at java.util.ArrayList$Itr.next(Unknown Source)
    2011-11-26 19:10:18 [SEVERE] at com.bergerkiller.bukkit.nolagg.Util.fillEntities(Util.java:81)
    2011-11-26 19:10:18 [SEVERE] at com.bergerkiller.bukkit.nolagg.NoLagg$2.run(NoLagg.java:169)
    2011-11-26 19:10:18 [SEVERE] at org.bukkit.craftbukkit.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:137)
    2011-11-26 19:10:18 [SEVERE] at net.minecraft.server.MinecraftServer.h(MinecraftServer.java:441)
    2011-11-26 19:10:18 [SEVERE] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:374)
    2011-11-26 19:10:18 [SEVERE] at net.minecraft.server.ThreadServerApplication.run(SourceFile:417)

    1.49.2
    1337
     

Share This Page