DAQEM / GriefLogger

A fast Minecraft mod that uses SQLite or MySQL to log player interactions.
https://daqem.com
Apache License 2.0
6 stars 5 forks source link

When breaking many block, server crashes. #42

Open creaper3 opened 7 months ago

creaper3 commented 7 months ago

When using a tool that breaks many blocks at the same time, the server will crash due to memory being full.

image

crash-2024-04-18_09.45.23-server.txt

Burchard36 commented 7 months ago

Same issue, really hope this is looked into soon as it crashes with larger modpacks like ATM9

Burchard36 commented 6 months ago

Seems the issue stems from the thread pool being used: https://github.com/DAQEM/GriefLogger/blob/3784012da5307b11806156fb5afdde2c9e6995f9/common/src/main/java/com/daqem/grieflogger/thread/ThreadManager.java#L14

This thread pool will infinitely create new thread if none are available in the pool, and will re-use old threads if any are opened up as per: https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/Executors.html#newCachedThreadPool-- - while the threads are generally extremely short lived the amount of threads being opened by mods like QuarryPlus, RFTools Builder, Builders Wands & More are triggering too many threads to be opened before the cached thread pool can clear them.

The error actually saying "Out Of Memory" is actually the OS/JVM Running out of physical resources, not your actual machine

@DAQEM It may be worth either looking into using some form of "Fixed" or maybe even a https://docs.oracle.com/javase/8/docs/api/java/util/concurrent/Executors.html#newWorkStealingPool-- that way the mod doesnt keep spewing open new threads when things get placed too fast, I'm running a fork of this using a WorkStealingPool and will see how well it holds up compared to the normal cached pool, if it works well I can PR the new pool in, or you can simply add it in as its just a one liner change

Burchard36 commented 6 months ago

After a few days of testing this on rather populated servers, using a WorkStealingPool has outright eliminated this crash without any performance disadvantages