Fast Async World Save[Forge/Fabric]

Fast Async World Save[Forge/Fabric]

21M Downloads

java.lang.OutOfMemoryError: unable to create native thread: possibly out of memory or process/resource limits reached

TheFlash787 opened this issue ยท 1 comments

commented

Describe the bug you're experiencing

After the server has been online for a while, the servers will stall, and then crash with the following stacktrace:

[16Jul2024 22:47:16.839] [Server thread/ERROR] [net.minecraft.server.MinecraftServer/]: Encountered an unexpected exception
java.lang.OutOfMemoryError: unable to create native thread: possibly out of memory or process/resource limits reached
	at java.lang.Thread.start0(Native Method) ~[?:?]
	at java.lang.Thread.start(Thread.java:1553) ~[?:?]
	at java.lang.System$2.start(System.java:2577) ~[?:?]
	at jdk.internal.vm.SharedThreadContainer.start(SharedThreadContainer.java:152) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor.addWorker(ThreadPoolExecutor.java:953) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor.execute(ThreadPoolExecutor.java:1375) ~[?:?]
	at java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:123) ~[?:?]
	at net.minecraft.world.level.storage.DimensionDataStorage.md6bd8c2$lambda$fastasyncworldsave$saveOffthread$1$0(DimensionDataStorage.java:548) ~[server-1.20.1-20230612.114412-srg.jar%23685!/:?]
	at java.util.HashMap.forEach(HashMap.java:1429) ~[?:?]
	at net.minecraft.world.level.storage.DimensionDataStorage.redirect$zof000$fastasyncworldsave$saveOffthread(DimensionDataStorage.java:530) ~[server-1.20.1-20230612.114412-srg.jar%23685!/:?]
	at net.minecraft.world.level.storage.DimensionDataStorage.m_78151_(DimensionDataStorage.java:126) ~[server-1.20.1-20230612.114412-srg.jar%23685!/:?]
	at net.minecraft.server.level.ServerLevel.m_8806_(ServerLevel.java:758) ~[server-1.20.1-20230612.114412-srg.jar%23685!/:?]
	at net.minecraft.server.level.ServerLevel.m_8643_(ServerLevel.java:737) ~[server-1.20.1-20230612.114412-srg.jar%23685!/:?]
	at net.minecraft.server.MinecraftServer.m_129885_(MinecraftServer.java:507) ~[server-1.20.1-20230612.114412-srg.jar%23685!/:?]
	at net.minecraft.server.MinecraftServer.m_195514_(MinecraftServer.java:532) ~[server-1.20.1-20230612.114412-srg.jar%23685!/:?]
	at net.minecraft.server.MinecraftServer.m_5705_(MinecraftServer.java:824) ~[server-1.20.1-20230612.114412-srg.jar%23685!/:?]
	at net.minecraft.server.MinecraftServer.m_130011_(MinecraftServer.java:661) ~[server-1.20.1-20230612.114412-srg.jar%23685!/:?]
	at net.minecraft.server.MinecraftServer.m_206580_(MinecraftServer.java:251) ~[server-1.20.1-20230612.114412-srg.jar%23685!/:?]
	at java.lang.Thread.run(Thread.java:1583) ~[?:?]

I notice that Util.ioPool() is being used, do these threads get cleaned up?

I have other mods installed, often with asynchronous logic, however every time it's always after the server has been online for a while, and only FastAsyncWorldSave that can't generate another thread.

I also find that the PIDs created on the machine rise quickly to the hundreds of thousands, or millions. Not the processes themselves, but the PID number chosen -- not sure if this is related.

Some additional context which might help:
image

ulimit-a shows that there should be plenty of processes available.

image

Reproducability

I don't think this can be easily replicated. However I am removing the mod from the server to see if these intermittent crashes still occur.

Mod up to date

  • Before submitting this issue I updated to the newest version and reproduced it

Minecraft version

1.20.1

Modloader version

Forge

Logs

https://gist.github.com/TheFlash787/02017f4a171957e0ece11289b158d361

commented

Can confirm it was not FAWS ๐Ÿ˜„

I had a thread leak in one of my mods.