DAQEM/GriefLogger

When breaking many block, server crashes.

Opened this issue · 3 comments

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

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

Seems the issue stems from the thread pool being used:

private static final ExecutorService executor = Executors.newCachedThreadPool(new GriefLoggerThreadFactory());

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

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