Petition to remove the /reload command

Discussion in 'Bukkit Discussion' started by Afforess, Oct 27, 2011.

Thread Status:
Not open for further replies.
     
  1. Offline

    Afforess

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    The reload command in bukkit is diabolical, and should be removed. I've stated this many times in private before, but I'm often surprised by the number of people who are unaware of the problems with reloading.

    Memory Leaks:
    To understand why the reload command is terrible, you have to understand how it works. /reload disables all active plugins, and then, creates a new instance of every plugin in the plugins folder. It does not reactivate the old, disabled plugins. It creates a new copy. Due to the way Java works, and how Bukkit implements it's classloaders, this causes a memory leak. This is easy to confirm with most java profilers. The memory leak is not super significant (I'd guess at most, 5mb per /reload), but it does exist. Unfortunately, Java's eccentricities make it pretty much impossible to fix this memory leak.

    The effects of the leak can be viewed by my profiling some months back. Nothing has changed with plugin loading since these screenshots were taken.

    Server running BukkitContrib without any reloads.

    Server running BukkitContrib 4 reloads later. (Plugins loaded 5 times total, 4 reloads + 1 startup)

    All of the classes and any static variables remain in memory.

    Poor Plugin Design:
    Memory leaks are not the worst part about the reload command. Many, MANY plugins handle reloads poorly, or not at all. I'm certain most server admins are painfully aware that when they use /reload, the console will spit out at least one error, usually more. Exceptions are extremely common with /reload. And before you begin to berate plugin developers for simple mistakes, know that it is often extremely difficult to handle reload situations perfectly, especially the more complex the plugin. The most complex case I am aware of is Spout, where we have literally, thousands of lines of code simply to handle the /reload command. And Spout still doesn't handle reloads perfectly. Plugins that use multiple threads to achieve their tasks (usually plugins using some form of SQL, or persistent storage....) will also fail to end their threads after the plugin shuts down. This means your server could be wasting CPU cycles for extra threads that are not needed or used.

    Lag, Lag, Lag:
    Assuming that your server has only selected the highest tier plugins, of exceeding quality that handle reload flawlessly, and has gigabytes of extra memory to handle any leaks from bukkit, reload will still lag for several seconds after you issue the command. It is not uncommon for players to be kicked for fly hacking, moving to quickly, or just to read time out from lag. You might as well have used the 15 seconds it takes to RESTART the server instead of reloading it.

    There are several plugins made specifically to offer a way to safely RESTART your server instead of reloading it, and I encourage admins to use them:

    http://forums.bukkit.org/threads/ad...w-v0-3_2-full-server-restarts-818-1060.20039/
    http://forums.bukkit.org/threads/ad...-automatic-rebooting-and-commands-1000.24652/
    http://forums.bukkit.org/threads/ad...t-down-at-the-same-time-every-day-1248.26101/
    http://forums.bukkit.org/threads/ad...detection-auto-saves-remote-console-1317.674/

    I'm personally inclined to simply block the reload command from any of my plugins, but I expect that would make admins unhappy. So instead, I'm trying to raise awareness of why the command is bad, what can happen when you use it, and alternatives for it.
    Icabash, dark navi, Jdwede and 41 others like this.
  2.  
  3. Offline

    Evangon

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    My server crashes when I use /reload. Corse, I'm using 35 plugins xD
    I don't know if I signed already, but here again:
    /sign :3
  4. Offline

    aolko

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
  5. Offline

    braydenhull

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Frankly I'd prefer if you guys kept it. It is optional after all..
    Keep it for those who want it by keeping it optional. It ain't hard to not type /reload ;)

    However there should be a bit of mythbusting. For example, I had a friend who would script his server to reload automatically after an hour or so because he thought it would release memory and make his server "more stable".
  6. Offline

    Celtic Minstrel

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    This could be done by spawning a new VM in a separate process just after shutting down the old VM. I'm not entirely sure whether this is possible with just Java, but it seems like it could be, maybe... Java does have an equivalent of fork(), doesn't it? Admittedly I haven't really looked closely... >_>
  7. Offline

    Korrosive

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    /signed

    This post has been edited 1 time. It was last edited by Korrosive Dec 7, 2011.
  8. Offline

    prodige30

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
  9. Offline

    Zelnehlun

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    /anti-signed

    This post has been edited 1 time. It was last edited by Zelnehlun Mar 8, 2012.
  10. Offline

    SkullM4sher

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    /signed

    This post has been edited 1 time. It was last edited by SkullM4sher Dec 13, 2011.
  11. Offline

    ty5123

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    eh i might aswell sign
    /sign
    :)
  12. Offline

    lucasdidur

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
  13. Offline

    Nekpek

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
  14. Offline

    tips48

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    /signed to bump
  15. Offline

    Kohle

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    So press the unlike button?

    @OnTopic
    /signed

    Edit: WOA OnTopic is a person :eek:

    This post has been edited 1 time. It was last edited by Kohle Dec 17, 2011.
  16. Offline

    ThatBox

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    The bukkit team hasn't even posted about the topic?

    /signed
  17. Offline

    nkrecklow

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
  18. Offline

    Armar

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
  19. Offline

    shovenose

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    /signed
    this is why my server would kick me out with a "bad login"error and it should go...
  20. Offline

    John Kapsis

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
  21. Offline

    hclewk

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    /anti-signed

    You want to remove a 100% optional command because you don't want to have to clean up after yourself when coding plugins? What? Really?

    Let me hit each of your points:
    Memory Leaks: 5MB/reload! That means if I reload 20 times (kinda ridiculous) I will be using 100MB extra memory! This is only an issue if you have super constrained resources. If you have super constrained resources, you don't have many people online, and it's not a big deal to reboot your server. Imaging trying to convince Google they need to disable tethering on all android phones because you have a tiny data cap.
    Poor Plugin Design: Yes, if you use shitty plugins, it's probably not a good idea to use /reload. I don't have shitty plugins. My server has 2 plugins, both coded by me, and there are absolutely no issues on /reload. You want Bukkit to remove the /reload command so that Spout doesn't look bad for not supporting it. Get off your high horse, and either support it or deal with the consequences. It's like trying to outlaw E85 gas, because a lot of cars don't run well on it. If you are using one of those cars, just don't freaking buy E85 - but let me have my cheap gas!
    Lag, Lag, Lag: You completely and conspicuously ignore the fact that rebooting your server kicks off everyone on it. BTW, /reload takes about 2 seconds on my server, and rebooting it takes 30. It's really not that big of a deal to reboot, and I generally do so during off-hours if I have updated a plugin or config file previously. But if I have 100 players online, it's a bit dumb to kick them all off so I can update a plugin. What if... I have no analogy for this one :(

    I have two plugins on my server, both coded by me. I have absolutely no issues when /reload-ing. I would be extremely pissed off if bukkit removed this command simply because Spout doesn't want to be a good citizen.

    As a side note, I removed Spout from my server b/c it was causing /reload issues.
  22. Offline

    ZNickq

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Memory Leaks: This leak keeps increasing, and more problems appear....

    Poor Plugin Design: You do not sound like you know much about programming, so i'd say that those 2 plugins are basic enough to not be affected...however, most plugins have problems, and have to spend hours working on fixes because the stupid server owner can't understand that reloading is bad...

    Lag, Lag, Lag: Yes, rebooting it kicks people off...and it also makes the server faster, doesn't have any problems with plugins! But OH MY GOD, it takes 30 seconds! How dare the plugin developers even suggest that you will waste 30 seconds of your precious time against hours of their! This is madness!
  23. Offline

    Celtic Minstrel

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    For what it's worth, /reload sometimes also kicks people off.
    3ric, alta189 and robxu9 like this.
  24. Offline

    NinjaZidane

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    To anyone that might reply to you and potentially call you "stupid" in any way...are in-correct. It is a matter of ignorance here.

    You have not even the slightest clue on post beginner topics of Java programming or perhaps programming in general. If you have even ATTEMPTED to make something that is at least 1/10 the complexity of something like Spout or WorldEdit or another massive plugin then you will have realized that reloads cannot be handled 100%. It is a fact: when a Bukkit server reloads, it merely makes a new object of each plugin on the stack and leaves the old instance in tack (until java garbage collects) and any static references carry over. This is typically what causes a memory leak to occur.

    Your next point...Spout looking bad for not supporting it? That made me laugh a little...first off there is no consequence for not supporting it (as any server admin that reads up on Bukkit just a little bit realizes reload is a bad command). Spout's plugin for Bukkit isn't designed bad at all...as a matter of fact its one of the best designed plugins that run on Bukkit (if not the best) but it does so much to Bukkit itself that it just cannot make itself "reload friendly".

    Now your last point....lag. Celestic Minstrel actually completely destroyed you with simply stating the fact that a reload can and will kick some people off the server (as sometimes a client doesn't recieve a packet quick enough from the server when doing so). AS A MATTER OF FACT you removed Spout and removed a perk that actually fixes it. If a person is kicked from something (such as a reload) then Spout can normally have them quickly relogin (without the user ever noticing)

    Ironic...huh?

    This post has been edited 3 times. It was last edited by NinjaZidane Dec 22, 2011.
  25. Offline

    jorisk322

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
  26. Offline

    Bios Element

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Supported. Such a feature causes no end of problems for server admin and it isn't really obvious that it shouldn't be used, since after all, it 'is' included so it should work...right? ^_^
  27. Offline

    hclewk

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    This is the problem with the internet. There is no way for anyone to know if anyone else is an authority on a subject, 'cause script kiddies say "Yeah! I can program!" (not that I'm saying you are a script kiddie). That said, I've been a professional freelance developer for 4 years, with 6 years of professional programming experience. I know programming.

    Anyway, the overarching point of my post was that none of the arguments the OP gave are sufficient for Bukkit to remove the reload command, which is what he is advocating. Should everyone use it? No. Does that warrant removal? Definitely not.

    @NinjaZidane

    Go to mcpvp.com. That's 1 plugin, that runs everything on the server. Got to mcctf.com. 1 plugin, entire server. Those aren't simple servers either. Both handle /reload's perfectly. I wrote them both.

    I'm not saying you can completely alleviate the memory leak - yes that must occur. I am saying you can be a good citizen and cleanup anything that would break on /reload.

    Spout may be the most complex and the most promising bukkit plugin. Calling it the "best designed" plugin for Bukkit is a bit of a stretch.

    As for /reload *sometimes* kicking people - not on my server with well designed plugins. It _never_ kicks people, as it takes < 2 seconds to /reload. Yes, it makes sense not to /reload if that command kicks people anyway. But it is not a valid argument to remove the /reload command because some servers can't use it.

    This is about REMOVING the /reload command from Bukkit. Not about the merits of using /reload.
  28. Offline

    TechHut

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    If you don't like it don't use it -.-

    I use it to test changes before a full restart.

    This post has been edited 1 time. It was last edited by TechHut Dec 23, 2011.
    hclewk likes this.
  29. Offline

    Delocaz

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    You know, why not make a third "forced" method/function/whatever called onReload() which would be called on a reload instead of an onDisable() followed by an onEnable(). Devs could either leave it empty or have it reload the configs and all that stuff.
  30. Offline

    Celtic Minstrel

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    I was thinking that as well... "best designed" really doesn't seem to describe it for me.

    I'm not sure if it's related to the number of plugins or just to the quality of the plugins, but sometimes when I reload people do get kicked. I do have a couple of plugins that might be considered fairly heavy though, such as CraftIRC or WorldEdit.
    hclewk likes this.
  31. Offline

    nkrecklow

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Congratulations, you've managed you run your server off a single plugin, what a fantastic idea! Because, as a experienced developer, you must know that running massive structures of easily breakable things is a great idea. Because, you know, what update could possibly break the plugin and cripple the server?
    Nathan C likes this.
  32. Offline

    Nathan C

    dev.bukkit.org profile:
    CFUSERNAME
    My Plugins (CFCOUNT)
    Not sure what to choose.

    Helps weed out the noob servers on one hand.

    Although it also creates spammy "WHY DID MY SERVER CHASH PLZ HELP!" threads on the other.

    This post has been edited 1 time. It was last edited by Nathan C Dec 31, 2011.
Thread Status:
Not open for further replies.

Share This Page