CoFH Crash java.lang.RuntimeException: java.lang.IllegalArgumentException: Equal objects must have equal hashcodes

Hello, I upgraded my Gregtech 6 version from 1.12.02 to 1.14.00 and the game gives an error like this when opening.

java.lang.RuntimeException: java.lang.IllegalArgumentException: Equal objects must have equal hashcodes. During rehashing, Trove discovered that the following two objects claim to be equal (as in java.lang.Object.equals()) but their hashCodes (or those calculated by your TObjectHashingStrategy) are not equal.This violates the general contract of java.lang.Object.hashCode().  See bullet point two in that method's documentation. object #1 =class cofh.lib.util.ItemWrapper id= 1286212845 hashCode= 334036993 toString= cofh.lib.util.ItemWrapper@1286212845{m:1, i:factorization.charge.ItemAcidBottle@1365366074, v:5097}; object #2 =class cofh.lib.util.ItemWrapper id= 189875608 hashCode= 334036993 toString= cofh.lib.util.ItemWrapper@189875608{m:1, i:factorization.charge.ItemAcidBottle@1365366074, v:5097}

hashCode() and/or equals() have inconsistent implementation
Key set lost entries, now got 1601 instead of 1602. This can manifest itself as an apparent duplicate key.
	at gregapi.api.Abstract_Mod.onModPreInit(Abstract_Mod.java:195)
	at gregtech.GT6_Main.onPreLoad(GT6_Main.java:641)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:532)
	at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
	at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
	at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
	at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
	at com.google.common.eventbus.EventBus.post(EventBus.java:275)
	at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:212)
	at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:190)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
	at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
	at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
	at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
	at com.google.common.eventbus.EventBus.post(EventBus.java:275)
	at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:119)
	at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:556)
	at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:243)
	at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:480)
	at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:878)
	at net.minecraft.client.main.Main.main(SourceFile:148)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at net.minecraft.launchwrapper.Launch.launch(Launch.java:135)
	at net.minecraft.launchwrapper.Launch.main(Launch.java:28)
Caused by: java.lang.IllegalArgumentException: Equal objects must have equal hashcodes. During rehashing, Trove discovered that the following two objects claim to be equal (as in java.lang.Object.equals()) but their hashCodes (or those calculated by your TObjectHashingStrategy) are not equal.This violates the general contract of java.lang.Object.hashCode().  See bullet point two in that method's documentation. object #1 =class cofh.lib.util.ItemWrapper id= 1286212845 hashCode= 334036993 toString= cofh.lib.util.ItemWrapper@1286212845{m:1, i:factorization.charge.ItemAcidBottle@1365366074, v:5097}; object #2 =class cofh.lib.util.ItemWrapper id= 189875608 hashCode= 334036993 toString= cofh.lib.util.ItemWrapper@189875608{m:1, i:factorization.charge.ItemAcidBottle@1365366074, v:5097}

hashCode() and/or equals() have inconsistent implementation
Key set lost entries, now got 1601 instead of 1602. This can manifest itself as an apparent duplicate key.
	at gnu.trove.impl.hash.TObjectHash.buildObjectContractViolation(TObjectHash.java:464)
	at gnu.trove.impl.hash.TObjectHash.throwObjectContractViolation(TObjectHash.java:448)
	at gnu.trove.map.hash.THashMap.rehash(THashMap.java:403)
	at gnu.trove.impl.hash.THash.postInsertHook(THash.java:388)
	at gnu.trove.map.hash.THashMap.doPut(THashMap.java:178)
	at gnu.trove.map.hash.THashMap.put(THashMap.java:145)
	at cofh.core.util.oredict.OreDictionaryArbiter.registerOreDictionaryEntry(OreDictionaryArbiter.java:92)
	at cofh.core.Proxy.onOreRegisterEvent(Proxy.java:100)
	at cpw.mods.fml.common.eventhandler.ASMEventHandler_114_Proxy_onOreRegisterEvent_OreRegisterEvent.invoke(.dynamic)
	at cpw.mods.fml.common.eventhandler.ASMEventHandler.invoke(ASMEventHandler.java:54)
	at cpw.mods.fml.common.eventhandler.EventBus.post(EventBus.java:140)
	at net.minecraftforge.oredict.OreDictionary.registerOreImpl(OreDictionary.java:561)
	at net.minecraftforge.oredict.OreDictionary.registerOre(OreDictionary.java:501)
	at gregapi.oredict.OreDictManager.registerOre_(OreDictManager.java:731)
	at gregapi.oredict.OreDictManager.registerOre(OreDictManager.java:721)
	at gregapi.util.OM.reg(OM.java:214)
	at gregapi.block.tree.BlockBaseBeam.<init>(BlockBaseBeam.java:45)
	at gregtech.blocks.wood.BlockTreeBeam1FireProof.<init>(BlockTreeBeam1FireProof.java:29)
	at gregtech.loaders.a.Loader_Woods.run(Loader_Woods.java:61)
	at gregtech.GT6_Main.onModPreInit2(GT6_Main.java:233)
	at gregapi.api.Abstract_Mod.onModPreInit(Abstract_Mod.java:166)
	... 37 more


A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Stacktrace:
	at gregapi.api.Abstract_Mod.onModPreInit(Abstract_Mod.java:195)
	at gregtech.GT6_Main.onPreLoad(GT6_Main.java:641)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at cpw.mods.fml.common.FMLModContainer.handleModStateEvent(FMLModContainer.java:532)
	at sun.reflect.GeneratedMethodAccessor2.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
	at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
	at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
	at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
	at com.google.common.eventbus.EventBus.post(EventBus.java:275)
	at cpw.mods.fml.common.LoadController.sendEventToModContainer(LoadController.java:212)
	at cpw.mods.fml.common.LoadController.propogateStateMessage(LoadController.java:190)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:497)
	at com.google.common.eventbus.EventSubscriber.handleEvent(EventSubscriber.java:74)
	at com.google.common.eventbus.SynchronizedEventSubscriber.handleEvent(SynchronizedEventSubscriber.java:47)
	at com.google.common.eventbus.EventBus.dispatch(EventBus.java:322)
	at com.google.common.eventbus.EventBus.dispatchQueuedEvents(EventBus.java:304)
	at com.google.common.eventbus.EventBus.post(EventBus.java:275)
	at cpw.mods.fml.common.LoadController.distributeStateMessage(LoadController.java:119)
	at cpw.mods.fml.common.Loader.preinitializeMods(Loader.java:556)
	at cpw.mods.fml.client.FMLClientHandler.beginMinecraftLoading(FMLClientHandler.java:243)
	at net.minecraft.client.Minecraft.func_71384_a(Minecraft.java:480)
	at net.minecraft.client.Minecraft.func_99999_d(Minecraft.java:878)

I solved this problem by downgrading to the ender io version 2.2.8.381 but I could not figure out why it gave error in version 2.3.0.429_beta.

2 Likes

Grrrrreat…

Factorizations Acid Bottle and Ender IO dont play well and somehow that crashes CoFHCore when I register something and I mean literally ANYTHING (such as WOOD) to the OreDict…

@OvermindDL1 Is there anything you can do to stop this with ASM?

2 Likes

It would be fixable in ASM regardless. I’ve not seen the code for those so I couldn’t say where to look though.

2 Likes

Gregtech 6 version 12.02 did not have this problem. It happened after updating. Do you have the ability to fix this issue in future releases?

2 Likes

I can tell you right away it definitely had that Issue before too. This Issue is stupidly complicated to explain, but it all depends on completely random circumstances like which Item IDs each Item has, which means if one Mod just adds one more Item (like GT6 did between the two updates) it can fuck over the whole System.

The real Issue here is that CoFH-Core was made in the most incompetent way possible, resulting in this Issue happening only when Factorization is installed for some dumb reason, because of its Acid Bottle doing something weird with its Hashcode. (yes I remember having that Issue years ago…)

2 Likes

Could you please try your broken Modpack with THIS version of GT6 and see if it works now? And yes please make sure that you didnt change the Modpack since then.


:gregory: This Version should be working for you. ^^

(note 1: The scary sounding Description is only there to make sure people don’t use that Version lightly.)

(note 2: if you use this Version more often, make sure your Browser didn’t cache the Download)

2 Likes

Thanks for the link. :slight_smile:
I had backed up the problematic profile. So I can test your edits.
Unfortunately that didn’t fix the problem either. :frowning:

Crash report;

The game crashed whilst initializing game
Error: java.lang.RuntimeException: java.lang.IllegalArgumentException: Equal objects must have equal hashcodes. During rehashing, Trove discovered that the following two objects claim to be equal (as in java.lang.Object.equals()) but their hashCodes (or those calculated by your TObjectHashingStrategy) are not equal.This violates the general contract of java.lang.Object.hashCode().  See bullet point two in that method's documentation. object #1 =class cofh.lib.util.ItemWrapper id= 1199108907 hashCode= 334102529 toString= cofh.lib.util.ItemWrapper@1199108907{m:1, i:factorization.charge.ItemAcidBottle@1975825171, v:5098}; object #2 =class cofh.lib.util.ItemWrapper id= 1709161336 hashCode= 334102529 toString= cofh.lib.util.ItemWrapper@1709161336{m:1, i:factorization.charge.ItemAcidBottle@1975825171, v:5098}

Ä°mage;

My jvm args: -Xmx10240m -Xms256m -XX:PermSize=256m -Dminecraft.applet.TargetDirectory=“C:\Users\gsera\Documents\Curse\Minecraft\Instances\gregtech6 (1)” -Dfml.ignorePatchDiscrepancies=true -Dfml.ignoreInvalidMinecraftCertificates=true -Duser.language=en -Duser.country=US

Log files;
2020-08-20-6.log (156.6 KB)
gregtech.log (6.2 KB)

2 Likes

Ah damn it, I hoped that would work, guess I need to check what kinda fucked up Hashing Strategy they use and fix that instead of the default Hash.

2 Likes

Okay attempt 2: “Just dont register the Acid Bottles from Factorization to the OreDict.”

Same link as before, just make sure your browser didnt cache the download. :wink:

2 Likes

I was able to enter the game successfully. Thanks for solving the problem. :slight_smile:

2 Likes

@Whistle So I found out how and where the Issue came from. Updating Factorization should fix the Issue properly. Asie is maintaining it by now instead of Neptunepink.

https://asie.pl/files/mods/Factorization/

This fix will be in the install Instructions of GT6 too, so the hack that I did to “fix” the Issue for you is not gonna be included, since updating Factorization fixes it amoung many other Issues. :wink:

2 Likes

I had searched for the new version before, but I was able to find the version of Factorization-1.7.10-0.8.108.jar.
I’ll try it soon. I’ll edit this message if it solves the problem. :slight_smile:

Edit;
Factorization version 0.8.109 fixed the problem. Thank you. :heart_eyes:

2 Likes