Some conflict with c2me with ThreadLocalRandom accessed from a different thread
coco875 opened this issue ยท 12 comments
Again it's a fabric mod loaded onto neoforge, connector is a experimental mod. Issue with fabric mods not being compatible with neoforge mods should be reported to connector as they are the compatibility layer. Unless you can detail exactly what needs to be fixed and why it's the fault of Apothic Enchanting and not connector or the fabric mod no support is expected or will be given when issues occur with it.
it's not a crash and work perfeclty fine without any error without Apothic-Enchanting it's just it produce some error in log along side with Apothic-Enchanting
With it being a fabric mod, it's might be a better bet to ask the connector support that enables them to be loaded alongside neoforge. Typically when using something experimental like connector errors will occur and sometimes they won't work together regardless. I believe they have a discord link listed on the modpack along side a github link as well.
of what I see it's not a strict incompatibility it's more a multithread issue provoke by c2me generating chunk in multiple thread. So I don't see how connector should fix it without make mixin in Apothic-Enchanting to make it thread safe
and the job of connector it's not to fix natural incompat of fabric experimental mod with neoforge mod, issue who will be the same if c2me have a native port. but let see what Apothic will confirm.
Apothic Enchanting needs to resolve getStateForPlacement
to generate enchanting stat tooltips, which passes through access to Minecraft#level
as one of the parameters. Another mod in your instance (paganbless
) appears to be randomly determining the placed state (which means it is accessing Level#random
from within this method), and that makes c2me
very upset with whatever validation it is doing. Unless you can see an actual crash, instead of just logspam, I'm inclined to think this is c2me being overzealous in its validation.
debug.log
latest.log
I reproduce the error with only apothic enchanting, apothic Attributes, c2me, connector and forgified fabric api. And like I mention he don't crash just produce this error in log.
You could install a mod like https://www.curseforge.com/minecraft/mc-mods/log-begone/files/all?page=1&pageSize=20 to get rid of the log spam, assuming that the log spamming is the only issue here.
there is log spam in the modpack where I put a bunch of mod but where I put the minimal set of mod it's just error make in background when c2me generate
when I retry now I get
[26sept.2024 18:10:14.175] [Thread-104/ERROR] [CheckedThreadLocalRandom/]: ThreadLocalRandom accessed from a different thread (owner: Render thread, current: Thread-104)
This is usually NOT a bug in C2ME, but a bug in another mod or in vanilla code.
Possible solutions:
- Find possible causes in the stack trace below and
- if caused by another mod, report this to the corresponding mod authors
- if no other mods are involved, report this to C2ME
java.util.ConcurrentModificationException: ThreadLocalRandom accessed from a different thread (owner: Render thread, current: Thread-104)
at TRANSFORMER/[email protected]/com.ishland.c2me.fixes.worldgen.threading_issues.common.CheckedThreadLocalRandom.handleNotOwner(CheckedThreadLocalRandom.java:55) ~[c2me-fabric-mc1.21.1-0.3.0+alpha.0.150$c2me-fixes-worldgen-threading-issues-mc1.21.1-0.3.0+alpha.0.150_mapped_moj_1.21.1.jar%231860!/:?]
at TRANSFORMER/[email protected]/com.ishland.c2me.fixes.worldgen.threading_issues.common.CheckedThreadLocalRandom.isSafe(CheckedThreadLocalRandom.java:38) ~[c2me-fabric-mc1.21.1-0.3.0+alpha.0.150$c2me-fixes-worldgen-threading-issues-mc1.21.1-0.3.0+alpha.0.150_mapped_moj_1.21.1.jar%231860!/:?]
at TRANSFORMER/[email protected]/com.ishland.c2me.fixes.worldgen.threading_issues.common.CheckedThreadLocalRandom.next(CheckedThreadLocalRandom.java:86) ~[c2me-fabric-mc1.21.1-0.3.0+alpha.0.150$c2me-fixes-worldgen-threading-issues-mc1.21.1-0.3.0+alpha.0.150_mapped_moj_1.21.1.jar%231860!/:?]
at TRANSFORMER/[email protected]/net.minecraft.world.level.levelgen.BitRandomSource.nextInt(BitRandomSource.java:33) ~[client-1.21.1-20240808.144430-srg.jar%23525!/:?]
at TRANSFORMER/[email protected]/net.minecraft.world.level.block.GrowingPlantHeadBlock.getStateForPlacement(net/minecraft/world/level/block/GrowingPlantHeadBlock.java:35) ~[client-1.21.1-20240808.144430-srg.jar%23525!/:?]
at TRANSFORMER/[email protected]/net.minecraft.world.level.block.GrowingPlantBlock.getStateForPlacement(GrowingPlantBlock.java:40) ~[client-1.21.1-20240808.144430-srg.jar%23525!/:?]
at TRANSFORMER/[email protected]/dev.shadowsoffire.apothic_enchanting.ApothEnchClient$ForgeBusEvents.tooltips(ApothEnchClient.java:110) ~[ApothicEnchanting-1.21.1-1.2.2.jar%23550!/:1.2.2]
at MC-BOOTSTRAP/net.neoforged.bus/net.neoforged.bus.EventBus.post(EventBus.java:350) ~[bus-8.0.2.jar%2396!/:?]
at MC-BOOTSTRAP/net.neoforged.bus/net.neoforged.bus.EventBus.post(EventBus.java:315) ~[bus-8.0.2.jar%2396!/:?]
at TRANSFORMER/[email protected]/net.neoforged.neoforge.event.EventHooks.onItemTooltip(net/neoforged/neoforge/event/EventHooks.java:441) ~[neoforge-21.1.61-universal.jar%23526!/:?]
at TRANSFORMER/[email protected]/net.minecraft.world.item.ItemStack.getTooltipLines(net/minecraft/world/item/ItemStack.java:813) ~[client-1.21.1-20240808.144430-srg.jar%23525!/:?]
at TRANSFORMER/[email protected]+1.21.1+neoforge/dev.emi.emi.api.stack.ItemEmiStack.getTooltipText(ItemEmiStack.java:162) ~[emi-1.1.13+1.21.1+neoforge.jar%23636!/:?]
at TRANSFORMER/[email protected]+1.21.1+neoforge/dev.emi.emi.search.EmiSearch.bake(EmiSearch.java:62) ~[emi-1.1.13+1.21.1+neoforge.jar%23636!/:?]
at TRANSFORMER/[email protected]+1.21.1+neoforge/dev.emi.emi.runtime.EmiReloadManager$ReloadWorker.run(EmiReloadManager.java:222) ~[emi-1.1.13+1.21.1+neoforge.jar%23636!/:?]
at java.base/java.lang.Thread.run(Unknown Source) [?:?]
so maybe it's a combinaison of emi and apothic enchanting
This could only occur if EMI is baking tooltips offthread (which it may be). If it is, EMI must not pass the Level
object to the worker threads, as concurrent access to the Level
is unsafe.