Just Enough Items (JEI)

Just Enough Items (JEI)

495M Downloads

[Crash]: ConcurrentModificationException: null (Keymappings are not being registered on Render Thread)

pietro-lopes opened this issue ยท 10 comments

commented

Steps to Reproduce the Crash

https://github.com/mezz/JustEnoughItems/blob/1.21.x/NeoForge/src/main/java/mezz/jei/neoforge/JustEnoughItemsClient.java#L47

Looks like Internal keybinds should be registered at Render Thread, as for neoforge there is a RegisterKeymappingsEvent for that

Mod Pack URL (Optional)

ATM10 with modifications

Mod Pack Version (Optional)

2.36

Extra Notes (Optional)

User added those mods

Added mods:
AC-Revitalized-1.21.1-4.4NF.jar
AirHop-v21.1.0-1.21.1-NeoForge.jar
ancient_enchantment_temple-1.0.1-neoforge-1.21.1.jar
AnimeInventoryPets Mod [1.21.1].jar
anvilrestoration-1.21.1-2.4.jar
armorhud-v4-1.21.1-neoforge.jar
BiomesOPlenty-neoforge-1.21.1-21.1.0.7.jar
butcher-3.0.1-neoforge-1.21.1.jar
collective-1.21.1-7.92.jar
compatible-protection-enchantments-2.1.jar
compatible-sword-enchantments-2.jar
dimdungeons-200-neoforge-1.21.0.jar
Dimensional-Paintings-1.21.1-5.2.1.jar
DistantFriends-neoforge-1.21.1-0.9.2.jar
durabilitytooltip-1.1.5-neoforge-mc1.21.jar
ExperienceRipper1.21.1.jar
extended-world-height-2.0.jar
firstperson-neoforge-2.4.8-mc1.21.jar
FiveHead-1.21-6.0.0.jar
forge-weeping_angels-mc1.21-v1.0.2-forge.jar
gamingbarns-morphs-v1.12-data.jar
GlitchCore-neoforge-1.21.1-2.1.0.0.jar
inventorytotem-1.21.1-3.3.jar
ItemBorders-1.21-neoforge-1.2.5.jar
linkingbooks-1.21.1-0.8.1.0-neoforge.jar
lucky_block-neoforge-0.1.3+1.21.1.jar
multiverse-1.21.1-4.1.1.jar
netherited-neoforge-1.21-2.0.0.jar
nightworld-neoforge-1.21-5.0.0.jar
nyfsspiders-neoforge-1.21.1-2.3.2.jar
purpurpacks-silk-touch-reinforced-deepslate-4.0.jar
PuzzlesLib-v21.1.27-1.21.1-NeoForge.jar
server-sided-portals-neoforge-1.21-2.0.1.jar
sit-1.21-1.3.5.jar
stop_lightning_destruction_of_item-1.0.0+1.21.1.jar
TaxFreeLevels-1.4.7-neoforge-1.21.1.jar
tectonic-neoforge-1.21.4-2.4.2.jar
TradeEnchantmentDisplay-neoforge-1.0.1+1.21.jar
transcendingtrident-1.21.1-4.9.jar
Tropicraft-9.8.0.jar
worldplaytime-1.2.2-1.21-NEOFORGE.jar

Crash Report

https://gnomebot.dev/paste/mclogs/wEsEvzk#L1420

commented

This has been automatically marked as stale because it has not had recent activity, and will be closed if no further activity occurs. If this was overlooked, forgotten, or should remain open for any other reason, please reply here to call attention to it and remove the stale status. Thank you for your contributions.

commented

Not the internal

commented
commented

Thanks for the report!

If you look at the implementation of the method you linked, you can see I register keybindings using the Neoforge RegisterKeyMappingsEvent here:

private static InternalKeyMappings createKeyMappings(PermanentEventSubscriptions subscriptions) {
Set<KeyMapping> keysToRegister = new HashSet<>();
subscriptions.register(RegisterKeyMappingsEvent.class, e -> keysToRegister.forEach(e::register));
return new InternalKeyMappings(keysToRegister::add);
}

Are you sure the issue is coming from JEI?

commented

Sorry no I am not telling you anything. I am asking if you can confirm the issue at runtime.

You have linked to code where the keybind is created. It is registered later in the event handler. Is there a problem with creating the unregistered keybind outside of the event handler?

commented

Ok thank you, that makes the issue clear. I will take a look when I next get a chance.

commented

Yes because how vanilla works, can't link Minecraft code but look at the constructor of KeyMapping class, they do multithread unsafe operations, so it can cause CME

commented

All of that is my own code which is separate. Everything is written to be deferred, and the registration only happens when the event is triggered.

Please try putting a breakpoint in a place that should only be run from the render thread, to see if there is an issue.

commented

here, are you telling me this is called on Render thread and not on the modloading thread?

commented

I have submitted a fix for this for JEI 1.21.1 and 1.21.5, please let me know if you run into any more issues.