"Restart" Plugin - Frees Memory

Discussion in 'Archived: Plugin Requests' started by jg16jg, Jan 7, 2013.

  1. Offline

    jg16jg

    Plugin category: Developer/Admin Tools

    Suggested name: AntiRestart

    What I want: Many people know that bukkit servers' memory usage increases over time until a restart. I propose a plugin that "restarts" the server without an actual shutdown. I know this may be a confusing topic so let me try to explain: A restart frees all the memory usage but annoys players. After a restart players play and memory usage builds. All the things causing the memory usage need to go but you have like 50 people on! You don't want to lose them! Instead use a plugin that does exactly what the restart does to free memory usage but without actually restarting. Does that make any sense?

    Ideas for commands: /ar, /antirestart, /ar restart (will actually restart), /ar freemem[ory] (does "restart"), /ar status (does exactly what LagMeter does within this plugin)

    Ideas for permissions: Must work with Vault and/or groupmanager
    antirestart.* - all permissions
    antirestart.restart - gives the command /ar restart
    antirestart.freememory - gives the command /ar freememory
    antirestart.status - gives the command /ar status

    When I'd like it by: Whenever available
     
  2. Offline

    jorisk322

    I don't think this is possible using the Bukkit API.
     
  3. Offline

    jg16jg

    I know NOTHING about java so enlighten me.
     
  4. Offline

    Chloe-chan

    Uh have you tried using /reload ? It is built in to Bukkit and deactivates all plugins and reactivate them.
     
  5. Offline

    jorisk322

    But it DEFINITELY doesn't free up space. It does, however, cause crashes and memory-leaks with some plugins.
     
    bobacadodl and breezeyboy like this.
  6. Offline

    breezeyboy

    Impossable with the bukkit api
     
  7. Offline

    Necrodoom

    is this even possible with MC, considering most of the leaks come from minecraft itself?
     
  8. Offline

    jg16jg

    I don't know anything about the code inside so is it possible at all? /reload only reloads everything bringing all that memory hogging stuff back in. If this is not possible do you know of any other possible solutions?
     
  9. Offline

    Ne0nx3r0

    You could very easily write a batch/shell script that restarts your server whenever it is shut down (after 3 seconds, if you want a delay to cancel it manually).

    Then you would just start your server using the script, and use /save-all, /stop. Technically save-all isn't required, but I've had some bad experiences just running stop.
     
  10. Offline

    amunro

  11. Offline

    jg16jg

    amunro Can you explain to me how this works and what it does? My computer is maxed on RAM so I don't want a program running that does too much and uses my precious RAM.

    What about this crazy theory: A program that can run one bukkit.jar and on the "restart" it starts an identical one with the memory usage already reset. Any possible way for this to happen?

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

    amunro

    Thats exactly what remote toolkit does. It launches and manages your bukkit.jar for you. If it crashes, it will terminate it and spawn a new one. To setup:

    Download and extract the serverdir folder to your root server folder. Go into toolkit folder and edit wrapper.properties and put in the RAM you use, the minecraft server jar name and any other settings.

    Then to start your server, just run the rtoolkit.bat file.
     
  13. Offline

    jg16jg

    amunro
    Cool! know of any plugins that will just do a restart? I have found some but they are for 1.1 or 1.2.5 and really outdated.
     
  14. Offline

    Lolmewn

    Not possible, as the plugin depends on Craftbukkit to work. If CraftBukkit would restart, the plugin would disable, causing the starting part of the plugin to never be called again.
     
  15. Offline

    jg16jg

    But instead of restarting bukkit why can't the memory be released. Unload everything so to speak.
     
  16. Offline

    LiLChris

    Sounds to me you have some sort of memory leak if this is an issue.

    Chunks is the main thing that stays loaded that would effect your memory, if your players are roaming around and you just unload the "memory" they would probably fall into the void or crash.

    Restarting is probably your best option.
     
  17. Offline

    amunro

    In an ideal world, yes this would be very possible, but I'm not familiar enough to give you an answer. I know that /reload reloads all plugins, but often the garbage collector will leave some things behind and this can cause serious memory issues. If bukkit (and plugins) were coded well enough, this would be very possible. I know improvements were made to the /reload command since I coded plugins, but I'm not sure what exactly they were.

    I would run some tests with the /reload command, and if you see it improving memory (doubtful), then try setup a cron to regularly execute the command. If that fails, your only option is to restart bukkit, which you can use remotetoolkit to do. Please note that remotetoolkit is not a plugin (it is easy to get confused). Its actually a wrapper that manages bukkit. Because remotetoolkit never shuts down, it can stop and start bukkit as it pleases.

    I also used to have memory issues as I once ran a server on an EC2 microinstance. There are plenty of resources about optimising your JVM to reduce ram usage. To be honest, if you are spotting a significant memory leak (the memory usage goes up over time), you should try removing plugins one by one until you spot which one it is, then report it to the developer. 99% of the time it's down to a plugin developer with bad coding practises who knows nothing of optimisation or garbage collection.
     

Share This Page