elBukkit / MagicPlugin

A Bukkit plugin for spells, wands and other magic
http://mine.elmakers.com
MIT License
247 stars 147 forks source link

CRASH SERVER #209

Closed Blamo27 closed 7 years ago

Blamo27 commented 7 years ago

Hello,

My server crashed : http://pastebin.com/89W2ScSn Magic memory leak ?

[07:22:49] [Thread-22/WARN]: Exception in thread "Thread-22" [07:22:49] [Thread-22/WARN]: java.lang.OutOfMemoryError: GC overhead limit exceeded [07:22:49] [Thread-22/WARN]: at net.coreprotect.database.Database.prepareStatement(Database.java:219) [07:22:49] [Thread-22/WARN]: at net.coreprotect.consumer.Process.processConsumer(Process.java:60) [07:22:49] [Thread-22/WARN]: at net.coreprotect.consumer.Consumer.run(Consumer.java:48) [07:22:49] [Thread-22/WARN]: at java.lang.Thread.run(Thread.java:745)

[Server thread/WARN]: [Magic] Task #760 for Magic v5.5.6-SNAPSHOT generated an exception java.lang.OutOfMemoryError: GC overhead limit exceeded

[Server thread/ERROR]: Encountered an unexpected exception java.lang.OutOfMemoryError: GC overhead limit exceede

Blamo27 commented 7 years ago

Crash again ...

NathanWolf commented 7 years ago

Considering that version of Magic is almost a year old it seems very unlikely for a memory leak to suddenly appear.

Have you added any other plugins lately?

You could of course try removing Magic to see if that's the problem. Unfortunately timings don't show memory use, so your other option is to run WarmToast or some other profiler.

Memory leaks are tricky, the thing that's leaking may not be the thing that shows up when memory happens to run out. It's just as likely to be CoreProtect, or basically anything else. Though if there is a stack trace with Magic stuff in it, I'd be interested to see that.

You could also try raising your memory limit, it may not be a memory leak but just more memory demand, in which case increasing the limit may fix the problem. If it is a true memory leak then that will only postpone the crash.

Blamo27 commented 7 years ago

We think that the issue is from the laser spell. You'll have more informations in few hours.

Blamo27 commented 7 years ago

After some testing, we found out that the issue was very similar to the one we encountered several months ago with Tornado : https://github.com/elBukkit/MagicPlugin/issues/158

When you cast Laser with increased spell damage, the server crashes. We are going to re-configure it the same way we did for Tornado so it won't happen again, I will update you on how that turns out.

Blamo27 commented 7 years ago

We found what was causing the issue, it was this piece of configuration right there in the laster actions : actions:

NathanWolf commented 7 years ago

Thanks for the info! I'll run this through a profiler when I get a chance.

NathanWolf commented 7 years ago

Ran through profiler, didn't come up with much. Profiling

Laser will track a lot of blocks, but not forever and there's not a whole lot of memory consumed there.

If you're able to run a profiler I'd be very eager to see it, otherwise I'm glad you worked around the problem on your end.

NathanWolf commented 7 years ago

I did find some good spots in EffectLib to optimize, though. Nothing that would really explain anything you're seeing, but that's a positive, at least.

Blamo27 commented 7 years ago

Yes run a profiler could be nice to see more informations. What is your profiler to check these informations ? It was impossible to see that with spigot timings.

NathanWolf commented 7 years ago

I use Flight recorder, it comes with the JDK. It's a little trickier to set up than WarmRoast but not too bad. You have to run your server with some options like this:

java -Xmx4098M -XX:MaxPermSize=256M \
-Dcom.sun.management.jmxremote.port=9010 \
-Dcom.sun.management.jmxremote.local.only=false \
-Dcom.sun.management.jmxremote.authenticate=false \
-Dcom.sun.management.jmxremote -jar spigot.jar -o true 

Then run "jmc" at the command-line and the Java Mission Control app will load, allowing you to attach to the spigot.jar instance while it's running and capture memory and CPU profile info.