Weird "OutOfMemoryError" Error

Discussion in 'Spigot Help' started by EshanK711, Jul 20, 2018.

  1. So my server will run fine for about the first 12 hours of it running. Then over time it gradually gets slower and slower and the server crashes at 20 hours. A simple restart fixes this issue, but I would really like to know why this is happening. I have a 4GB server with 93 plugins and like 5 daily players. Maybe I just need to get more GB's, but why does the server run fine for 20 hours then crash? I've also had some players have connection issues before, this may be connected.

    Heres the error: https://pastebin.com/U0S97PLX

    "LiteBans" is listed many times throughout the errors. Should I just delete the plugin? Is there a storge issuse? Should I update it?

    Thank you, anyone, who will help me with this :).
     
  2. Man you say 4GB? For 93 plugins? 20 hours running is a lot with the memory that you assign lol. Why 93? Lol can you paste your plugin list here?
     
    • Agree Agree x 1
  3. LiteBans is listed several times because it runs across multiple threads, and since there is no memory left, the threads can't run.

    93 plugins is excessive, you should attempt to reduce the number of plugins you have, which may allow your sever to run longer.
     
    • Agree Agree x 1
  4. I am sure having 93 plugins enabled causes some issues, as some of them probably call the same event when triggered, which could cause lag spikes depending on what the plugin may be doing at that time. Plus, if you have that many plugins, you may have some being disabled/interrupted by others if they are similar (ex. PermissionsEX and GroupManager conflict as permission plugins).
     
  5. That the server runs fine for 20 hours, and THEN goes out of memory is a clear indication of a memory leak. Reducing the amount of plugins will buy you a few minutes before it goes out of memory (insignificant), unless one of the removed plugins contained the memory leak.

    You will need to profile the JVM heap to find the plugin(s) with a memory leak, and then remove those plugins or have the author fix the memory leak.
     
  6. How would I do this? Can you instruct me? Thank you.
     
  7. Thank you to everyone helping me out on this? How many GB's do you think would keep this from not happening?
     
  8. Infinite? A memory leak will just suck up memory until it's all gone, so even if you allocate more, it won't help your situation.

    You'll have to profile the Jvm after 12 or so hours or right before it would crash to see where the problem exists.
     
  9. Well for the matters of 93 plugins which is extremely high. I would probally say around the 8GB if not more.
     
  10. How do I do that?
     
  11. People saying "oh it is because you have too many plugins".

    No, how many plugins he is using doesn't interfere with anything at all, you can have just one single plugin on your server that is wreaking havoc on your server or you can have 100 plugins that works fine, also, more plugins doesn't mean that you need more memory.

    For memory leaks, if you can edit your server startup script (I hope you can), there is two JVM arguments that can help you out:
    Code (Text):
    -XX:+ExitOnOutOfMemoryError
    If an OutOfMemoryError happens, the server will shutdown automatically, this is dangerous since it can cause data corruption or data loss, however your server won't be stuck on a OutOfMemoryError loop.

    That seems dangerous, but it is awesome with
    Code (Text):
    -XX:+HeapDumpOnOutOfMemoryError
    If an OutOfMemoryError happens, it will create a heap dump of the memory (an hprof file), allowing you to analyze the memory dump at the time of the crash using VisualVM or Eclipse's Memory Analyzer (just drag and drop the file into it) or any other Java profiler.

    If you think shutting down the server is too dangerous, you can also create a memory dump manually by using (go to your Java installation folder (and the bin folder) first!)
    Code (Text):
    jmap -dump:format=b,file=filename.hprof {PID}
    You can get your process ID with
    Code (Text):
    ps aux
    Yeah, your machine will probably have a lot of processes, you can filter them by using
    Code (Text):
    ps aux | grep texthere

    Example:
    ps aux | grep java
    Your local machine needs to have enough memory to open the memory dump, example: If the memory dump is 8GBs, you will need 8GBs on your computer to open it, if you don't have enough memory, you can use Eclipse's Memory Analyzer on another machine with more RAM (because sometimes my memory dumps are too big, I run Eclipse's Memory Analyzer on my dedicated machine, it can analyze the memory dump (which creates all the indexes) and can even create reports of what are the suspects and a bunch of other cool stuff)

    If you are using shared hosting... well, good luck trying to figure out the issue.
     
    • Agree Agree x 1
    • Useful Useful x 1
  12. What most people do is have automatic reboots for example. Pick a time where no one is on the network or minimal people are on and just have the server reboot every day at a set time. It will help with the server crashing but the memory leak will still be there. Check, double check and maybe even triple check your plugins are on the latest build for your server version. Stick with 1.12.2 or when 1.13 comes out with that and keep up to date on everything. That will help reduce the memory leaks and issues you are experiencing. Maybe just adding 1gb extra ram will help add more time but the issues will still be there. There will just be more resources for the leak to use. I hope this helps in some way >.<
     
    • Agree Agree x 1
  13. Thanks for all of this. But, my server is hosted on a website. Is there a way I can still edit my startup script etc?
     
  14. Thanks for the help. I do have scheduled reboots, but I think it would be more beneficial if I could remove the problems altogether. Since it might be linked to connection issues. I have a lot of plugins, manually updating all of them will take a long time. Should I even have to? My server is on 1.12.2. I'm not sure adding more GB's will help.
     
  15. Alright so, I looked some things up and I downloaded what I think is the Mutlicraft startup code file. This is what Is in it right now:
    Code (Text):
    ## See the default craftbukkit.jar.conf for a detailed documentation of the
    ## format of this file.
    [config]
    name = Spigot
    source = http://www.multicraft.org/download/jar/?file=spigot&version=latest&client=multicraft
    configSource = http://www.multicraft.org/download/conf/?file=spigot.jar.conf
    category = Mods

    [encoding]
    #encode = system
    #decode = system
    #fileEncoding = latin-1

    [start]
    command = "{JAVA}" -Xmx4G -Xms4G -XX:MaxPermSize=128M -Djline.terminal=jline.UnsupportedTerminal -jar "{JAR}" nogui
     
    Can you help me configure this code to what I need it to be to find this memory leak? I know you gave me code to put in, but I'm really new to this so a step by step instruction would be incredibly helpful. Thanks!
     
  16. Sounds like a plugin is memory leaking
     
  17. UPDATE! I created a heap dump and put it in the Eclipses Memory Analyzer. It gave a few leaks suspects I didn't understand. So just to be sure, I deleted every world and plugin from my server and the Analyzer gave me the same leak suspects. So, I don't think I have a leak, I think I just have slow plugins. What do you guys think?