None threadsafe call happening in IngredientObserver
JobVideoJoe opened this issue ยท 5 comments
Seems like there is an issue with a none thread safe call.
Issue type:
- ๐ Bug
Short description:
Getting this in the error log, and long pause with tps dropping very low to 1 or 2:
[20:25:04] [pool-12-thread-1477/WARN] [FML]: ****************************************
[20:25:04] [pool-12-thread-1477/ERROR] [Sponge]: //
[20:25:04] [pool-12-thread-1477/ERROR] [Sponge]: /* Illegal Async Chunk Load */
[20:25:04] [pool-12-thread-1477/ERROR] [Sponge]: //
[20:25:04] [pool-12-thread-1477/ERROR] [Sponge]: /* Sponge relies on knowing when chunks are being loaded as chunks add entities to /
[20:25:04] [pool-12-thread-1477/ERROR] [Sponge]: / the parented world for management. These operations are generally not threadsafe /
[20:25:04] [pool-12-thread-1477/ERROR] [Sponge]: / and shouldn't be considered a "Sponge bug ". Adding/removing entities from /
[20:25:04] [pool-12-thread-1477/ERROR] [Sponge]: / another thread to the world is never ok. /
[20:25:04] [pool-12-thread-1477/ERROR] [Sponge]: / /
[20:25:04] [pool-12-thread-1477/ERROR] [Sponge]: / Chunk Pos : 171, 107 /
[20:25:04] [pool-12-thread-1477/ERROR] [Sponge]: / /
[20:25:04] [pool-12-thread-1477/ERROR] [Sponge]: / java.lang.Exception: Async Chunk Load Detected /
[20:25:04] [pool-12-thread-1477/ERROR] [Sponge]: / net.minecraft.world.chunk.Chunk.handler$startLoad$zpn000(Chunk.java:5358) /
[20:25:04] [pool-12-thread-1477/ERROR] [Sponge]: / net.minecraft.world.chunk.Chunk.func_76631_c(Chunk.java) /
[20:25:04] [pool-12-thread-1477/ERROR] [Sponge]: / net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:108) /
[20:25:04] [pool-12-thread-1477/ERROR] [Sponge]: / net.minecraft.world.gen.ChunkProviderServer.func_186028_c(ChunkProviderServer.java:89) /
[20:25:04] [pool-12-thread-1477/ERROR] [Sponge]: / net.minecraft.world.gen.ChunkProviderServer.redirect$onProvideChunkHead$zml000(ChunkProviderServer.java:678) /
[20:25:04] [pool-12-thread-1477/ERROR] [Sponge]: / net.minecraft.world.gen.ChunkProviderServer.func_186025_d(ChunkProviderServer.java:135) /
[20:25:04] [pool-12-thread-1477/ERROR] [Sponge]: / net.minecraft.world.World.func_72964_e(World.java:310) /
[20:25:04] [pool-12-thread-1477/ERROR] [Sponge]: / net.minecraft.world.World.func_175726_f(World.java:305) /
[20:25:04] [pool-12-thread-1477/ERROR] [Sponge]: / net.minecraft.world.World.func_175625_s(World.java:6347) /
[20:25:04] [pool-12-thread-1477/ERROR] [Sponge]: / org.cyclops.cyclopscore.helper.TileHelpers.getSafeTile(TileHelpers.java:41) /
[20:25:04] [pool-12-thread-1477/ERROR] [Sponge]: / org.cyclops.cyclopscore.helper.TileHelpers.getCapability(TileHelpers.java:115) /
[20:25:04] [pool-12-thread-1477/ERROR] [Sponge]: / org.cyclops.cyclopscore.helper.TileHelpers.getCapability(TileHelpers.java:90) /
[20:25:04] [pool-12-thread-1477/ERROR] [Sponge]: / org.cyclops.cyclopscore.helper.TileHelpers.getCapability(TileHelpers.java:77) /
[20:25:04] [pool-12-thread-1477/ERROR] [Sponge]: / org.cyclops.integrateddynamics.core.network.IngredientObserver.observe(IngredientObserver.java:212) /
[20:25:04] [pool-12-thread-1477/ERROR] [Sponge]: / org.cyclops.integrateddynamics.core.network.IngredientObserver.lambda$observe$1(IngredientObserver.java:152) /
[20:25:04] [pool-12-thread-1477/ERROR] [Sponge]: / java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) /
[20:25:04] [pool-12-thread-1477/ERROR] [Sponge]: / java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) /
[20:25:04] [pool-12-thread-1477/ERROR] [Sponge]: / java.lang.Thread.run(Thread.java:748) */
[20:25:04] [pool-12-thread-1477/ERROR] [Sponge]: /********************************************************************************************************************/
Steps to reproduce the problem:
Put half an energy network in a chunk loaded with ftb utils. And the other half in a none loaded chunk next to it. Integrated Dynamics makes a call to see if the energy interface is active which it does from a different thread in IngredientObserver.java. This must call back to the main thread, or cause a chunk to be loaded on a different thread. Which generates this error in SpongeForge.
Versions:
Integrated Dynamics 1.0.2
Can you keep most of the processing in the background thread, but put the chunk loading in the main thread?
Now that I think of it, ID 1.0.3 (and 1.0.4) will explicitly check if a chunk is loaded before observing a position. @JobVideoJoe Can you please try again with the latest ID release?
shouldn't be considered a "Sponge bug "
Well, it is :-)
IngredientObservers run in their own thread, and a lot of effort has been put into making them thread-safe (read-only). This works fine in non-spongeforge worlds.
In any case, you can disable ingredientNetworkObserverEnableMultithreading
, which will make these observers run on the main thread, which should resolve the spongeforge error.
I can look into automatically disabling this option when a spongeforge environment is detected. (Or at least document it)
It looks like you probably did fix this issue with your:
Add safety for ingredient observer when positions are not loaded
Commit.
I will let you know if it keeps happening in the once able to test everything with the latest version. This is JobVideoJoe. Just submitted the bug on my work Github by mistake.
May I also add, I really love this mod!