Concurrent Chunk Management Engine (Fabric)

Concurrent Chunk Management Engine (Fabric)

231k Downloads

C2ME giving ThreadLocalRandom warning with Mc2Discord

elitesdead opened this issue ยท 1 comments

commented

Describe the bug

There is no crash or serious problem, but the following log appears in console. Everything otherwise works as intended, but I am wondering if there is a way to prevent this from showing up?

To Reproduce
Steps to reproduce the behavior:

  1. Use Mc2Discord and configure the ability to use commands from Discord server.
  2. When using a "/give" command from the Discord server, the command works, but throws a warning error "An unexpected error occurred trying to execute that command." in the Discord channel.
  3. Go to console to see error message.

Expected behavior
"An unexpected error occurred trying to execute that command" should not appear in the channel which Mc2Discord is connected to when using "/give" commands.
Preferably no error message in console.

Screenshots

Runtime info (please complete the following information):

  • OS: Windows 10
  • Minecraft version: 1.21
  • Mod version: c2me-fabric-mc1.21-0.2.0+alpha.11.107.jar
  • Mod branch: (fill this if you are not using the default ver branches)

Crash reports / logs

[02:43:35] [d4j-events-68/ERROR]: ThreadLocalRandom accessed from a different thread (owner: Server thread, current: d4j-events-68)
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: Server thread, current: d4j-events-68)
	at com.ishland.c2me.fixes.worldgen.threading_issues.common.CheckedThreadLocalRandom.handleNotOwner(CheckedThreadLocalRandom.java:55) ~[c2me-fixes-worldgen-threading-is11.106+1.21-81a7270bfcefabcc.jar:?]
	at com.ishland.c2me.fixes.worldgen.threading_issues.common.CheckedThreadLocalRandom.isSafe(CheckedThreadLocalRandom.java:38) ~[c2me-fixes-worldgen-threading-is11.106+1.21-81a7270bfcefabcc.jar:?]
	at com.ishland.c2me.fixes.worldgen.threading_issues.common.CheckedThreadLocalRandom.method_43156(CheckedThreadLocalRandom.java:86) ~[c2me-fixes-worldgen-threading-is11.106+1.21-81a7270bfcefabcc.jar:?]
	at net.minecraft.class_6566.method_43058(class_6566.java:61) ~[server-intermediary.jar:?]
	at net.minecraft.class_1542.<init>(net/minecraft/class_1542.java:71) ~[server-intermediary.jar:?]
	at net.minecraft.class_1657.method_7329(net/minecraft/class_1657.java:762) ~[server-intermediary.jar:?]
	at net.minecraft.class_3222.method_7329(net/minecraft/class_3222.java:1846) ~[server-intermediary.jar:?]
	at net.minecraft.class_1657.method_7328(net/minecraft/class_1657.java:747) ~[server-intermediary.jar:?]
	at net.minecraft.class_3068.method_13401(class_3068.java:74) ~[server-intermediary.jar:?]
	at net.minecraft.class_3068.method_13403(class_3068.java:42) ~[server-intermediary.jar:?]
	at com.mojang.brigadier.context.ContextChain.runExecutable(ContextChain.java:73) ~[brigadier-1.2.9.jar:?]
	at net.minecraft.class_8865.method_54416(class_8865.java:29) ~[server-intermediary.jar:?]
	at net.minecraft.class_8865.execute(class_8865.java:13) ~[server-intermediary.jar:?]
	at net.minecraft.class_8856.method_54405(class_8856.java:8) ~[server-intermediary.jar:?]
	at net.minecraft.class_8847.method_54388(class_8847.java:8) ~[server-intermediary.jar:?]
	at net.minecraft.class_8854.method_54390(class_8854.java:107) ~[server-intermediary.jar:?]
	at net.minecraft.class_2170.method_54313(net/minecraft/class_2170.java:379) ~[server-intermediary.jar:?]
	at net.minecraft.class_2170.method_9249(net/minecraft/class_2170.java:309) ~[server-intermediary.jar:?]
	at net.minecraft.class_2170.method_44252(net/minecraft/class_2170.java:299) ~[server-intermediary.jar:?]
	at fr.denisd3d.mc2discord.minecraft.MinecraftImpl.executeCommand(MinecraftImpl.java:142) ~[mc2discord-fabric-1.21.x-4.2.4.jar:?]
	at fr.denisd3d.mc2discord.core.events.DiscordEvent.processCommand(DiscordEvent.java:81) ~[mc2discord-fabric-1.21.x-4.2.4.jar:?]
	at fr.denisd3d.mc2discord.core.events.DiscordEvent.onMessageCreate(DiscordEvent.java:58) ~[mc2discord-fabric-1.21.x-4.2.4.jar:?]
	at fr.denisd3d.mc2discord.shadow.reactor.core.publisher.LambdaSubscriber.onNext(LambdaSubscriber.java:160) ~[mc2discord-fabric-1.21.x-4.2.4.jar:?]
	at fr.denisd3d.mc2discord.shadow.reactor.core.publisher.FluxContextWrite$ContextWriteSubscriber.tryOnNext(FluxContextWrite.java:115) ~[mc2discord-fabric-1.21.x-4.2.4.jar:?]
	at fr.denisd3d.mc2discord.shadow.reactor.core.publisher.FluxDoFinally$DoFinallyConditionalSubscriber.tryOnNext(FluxDoFinally.java:172) ~[mc2discord-fabric-1.21.x-4.2.4.jar:?]
	at fr.denisd3d.mc2discord.shadow.reactor.core.publisher.FluxPeekFuseable$PeekFuseableConditionalSubscriber.tryOnNext(FluxPeekFuseable.java:530) ~[mc2discord-fabric-1.21.x-4.2.4.jar:?]
	at fr.denisd3d.mc2discord.shadow.reactor.core.publisher.FluxHandleFuseable$HandleFuseableConditionalSubscriber.tryOnNext(FluxHandleFuseable.java:559) ~[mc2discord-fabric-1.21.x-4.2.4.jar:?]
	at fr.denisd3d.mc2discord.shadow.reactor.core.publisher.FluxMapFuseable$MapFuseableConditionalSubscriber.tryOnNext(FluxMapFuseable.java:317) ~[mc2discord-fabric-1.21.x-4.2.4.jar:?]
	at fr.denisd3d.mc2discord.shadow.reactor.core.publisher.FluxFilterFuseable$FilterFuseableConditionalSubscriber.tryOnNext(FluxFilterFuseable.java:367) ~[mc2discord-fabric-1.21.x-4.2.4.jar:?]
	at fr.denisd3d.mc2discord.shadow.reactor.core.publisher.FluxPublishOn$PublishOnConditionalSubscriber.runAsync(FluxPublishOn.java:992) ~[mc2discord-fabric-1.21.x-4.2.4.jar:?]
	at fr.denisd3d.mc2discord.shadow.reactor.core.publisher.FluxPublishOn$PublishOnConditionalSubscriber.run(FluxPublishOn.java:1067) ~[mc2discord-fabric-1.21.x-4.2.4.jar:?]
	at fr.denisd3d.mc2discord.shadow.reactor.scheduler.forkjoin.ForkJoinPoolScheduler$DisposableWorkerTask.run(ForkJoinPoolScheduler.java:443) ~[mc2discord-fabric-1.21.x-4.2.4.jar:?]
	at fr.denisd3d.mc2discord.shadow.reactor.scheduler.forkjoin.ForkJoinPoolScheduler$Worker.processTaskQueue(ForkJoinPoolScheduler.java:407) ~[mc2discord-fabric-1.21.x-4.2.4.jar:?]
	at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1423) [?:?]
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:387) [?:?]
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1312) [?:?]
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1843) [?:?]
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1808) [?:?]
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:188) [?:?]

Other mods
https://pastebin.com/CCimkmFw

Checklist

  • I am using the official version of the mod.
  • I tried the latest development version but the issue persists.
  • I searched for similar open issues and could not find an existing bug report on this.

Additional context
I've seen you said something about how mods like Mc2Discord do something that results in unexpected behavior, but does that mean there is no way to resolve this? Could setting enforceSafeWorldRandomAccess to "false" work? I don't really plan to add any other experimental mods, and my server is running fine otherwise. Or is there a different way to resolve this?

commented

It is because Mc2Discord isn't running commands on the server thread. It should be reported to Mc2Discord instead.