Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Non thread-safe dispenser behavior registration #13

Open
pau101 opened this issue Jul 4, 2020 · 2 comments
Open

Non thread-safe dispenser behavior registration #13

pau101 opened this issue Jul 4, 2020 · 2 comments
Labels
1.14.4 Minecraft 1.14.4 1.15.2 Minecraft 1.15.2 compatibility An issue occurred because of incompatibility.

Comments

@pau101
Copy link

pau101 commented Jul 4, 2020

The current dispenser behavior registration is not thread safe, as FMLCommonSetup is a parallel dispatched event and DispenserBlock#registerDispenseBehavior does not support concurrency. When additional mods are installed which have this similar code the game may fail to load from the internal registry map being put into a bad state.

Stacktrace:

java.lang.ArrayIndexOutOfBoundsException: 1024
	at it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap.rehash(Object2ObjectOpenHashMap.java:906) ~[?:?]
	at it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap.insert(Object2ObjectOpenHashMap.java:273) ~[?:?]
	at it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap.put(Object2ObjectOpenHashMap.java:281) ~[?:?]
	at net.minecraft.block.DispenserBlock.func_199774_a(SourceFile:46) ~[?:?]
	at andrews.pandoras_creatures.registry.util.PCDispenserBehaviors.registerAll(PCDispenserBehaviors.java:47) ~[?:1.14.4-0.13.1]
	at andrews.pandoras_creatures.Main.setupCommon(Main.java:91) ~[?:1.14.4-0.13.1]

The typical remedy is to use DeferredWorkQueue as you have so far for entity spawn registration. This issue also applies to the current feature registration as that is not concurrent either.

@andrew0030 andrew0030 added 1.14.4 Minecraft 1.14.4 1.15.2 Minecraft 1.15.2 compatibility An issue occurred because of incompatibility. investigating Currently working on this issue labels Sep 24, 2020
@andrew0030
Copy link
Owner

Ill make sure to fix this in the 1.16 version thanks for pointing it out.

@andrew0030
Copy link
Owner

Just want to point out that this has been fixed in the 1.16.3-2.0.0 version. I wont close the issue because I will probably still release a bug fix version for 1.15.2 and maybe 1.14.4

@andrew0030 andrew0030 removed the investigating Currently working on this issue label Oct 10, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1.14.4 Minecraft 1.14.4 1.15.2 Minecraft 1.15.2 compatibility An issue occurred because of incompatibility.
Projects
None yet
Development

No branches or pull requests

2 participants