Mekanism Additions

Mekanism Additions

21M Downloads

ThreadMinerSearch does not use a ChunkCache to scan the world, resulting in off thread world access / CME's

clienthax opened this issue ยท 9 comments

commented

Please use the search functionality before reporting an issue. Also take a look at the closed issues!

Issue description:

ThreadMinerSearch does not use a ChunkCache to scan the world, resulting in off thread world access / CME's
This can cause clients around the miner to disconnect too occasionally.

Version (make sure you are on the latest version before reporting):

Forge: forge-1.12.2-14.23.5.2847-universal.jar
Mekanism: Mekanism-1.12.2-9.8.2.389.jar
Other relevant version:

If a (crash)log is relevant for this issue, link it here: (It's almost always relevant)

Exception in thread "Thread-88" java.lang.IllegalStateException: CauseStackManager called from off main thread (current='ThreadMinerSearch{class=class mekanism.common.content.miner.ThreadMinerSearch, name=Thread-88, priority=5, group=net.minecraftforge.fml.common.thread.SidedThreadGroup[name=SERVER,maxpri=10]}', expected='Thread{class=class java.lang.Thread, name=Server thread, priority=5, group=net.minecraftforge.fml.common.thread.SidedThreadGroup[name=SERVER,maxpri=10]}')!
at org.spongepowered.common.event.SpongeCauseStackManager.enforceMainThread(SpongeCauseStackManager.java:121)
at org.spongepowered.common.event.SpongeCauseStackManager.getCurrentCause(SpongeCauseStackManager.java:136)
at net.minecraft.world.chunk.Chunk.handler$impl$UpdateNeighborsOnLoad$zma000(Chunk.java:3043)
at net.minecraft.world.chunk.Chunk.func_76631_c(Chunk.java:863)
at net.minecraftforge.common.chunkio.ChunkIOProvider.syncCallback(ChunkIOProvider.java:109)
at net.minecraftforge.common.chunkio.ChunkIOExecutor.syncChunkLoad(ChunkIOExecutor.java:94)
at net.minecraft.world.gen.ChunkProviderServer.loadChunk(ChunkProviderServer.java:118)
at net.minecraft.world.gen.ChunkProviderServer.func_186028_c(ChunkProviderServer.java:89)
at net.minecraft.world.gen.ChunkProviderServer.redirect$impl$ProvideChunkForced$zmd000(ChunkProviderServer.java:1158)
at net.minecraft.world.gen.ChunkProviderServer.func_186025_d(ChunkProviderServer.java:135)
at net.minecraft.world.World.func_72964_e(World.java:310)
at net.minecraft.world.World.func_175726_f(World.java:305)
at net.minecraft.world.WorldServer.func_180495_p(WorldServer.java:5064)
at mekanism.common.content.miner.ThreadMinerSearch.run(ThreadMinerSearch.java:68)
commented

I have yet to see a crash without sponge. But yes it is known about and will be fixed at some stage

commented

I have yet to see a crash without sponge. But yes it is known about and will be fixed at some stage

It seems to annoy sponges tracking, however it still is breaking expected contracts, I will look into it if I have the time but it should be fairly easy to fix, just grabbing a chunkcache and passing that into the thread instead.

commented

@thiakil is

if (state.getBlockHardness(chunkCache, testPos) >= 0) {

Required, if so what is its actual use here? 1.12.2 doesn't accept a chunkcache for this, but on 1.14 it shouldn't be an issue

commented

I believe that makes sure the block is "breakable" as things with negative hardness (barriers, bedrock) should not be broken by the miner ever. I haven't looked too much into the miner code at any point so not sure if it is needed there or can be moved, but I think that is what that check is doing.

commented

Yup that'd be it

commented

PR for 1.14.X submitted, will need to find a way to do the breakable check in 1.12.2 ๐Ÿค”

commented

PR for 1.12.2 submitted, have had to move the breakable check onto the main thread in canBreak, #5692

commented

@thiakil Have you had a chance to look at the 1.12.2 PR yet?

commented

Closing this as we're now only tracking issues for MC 1.15.2 and onwards.