[0.15.1280] Hash collision between X and Y: both have short hash 0

Started by Haplo, August 31, 2016, 10:47:49 AM

Previous topic - Next topic

Haplo

As requested by Tynan I'm posting this error description here in the bug forum, even though it might be mod related.

So here is problem:

I was updating my mods and with one mod I have the problem that whenever I load a game, it throws hash-collision errors.
Additionally most of the map isn't created (mountains are missing, ...)

The log only has these errors: (excerp)

Initializing map from file mod_test with mods Core, Miscellaneous_Core, PowerSwitch, Miscellaneous_MapGenerator, Miscellaneous_TrainingFacility, and Miscellaneous_Objects

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)

Hash collision between Wort and  Beer: both have short hash 0

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)

Hash collision between GoJuice and  Beer: both have short hash 0

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)

Hash collision between Luciferium and  Beer: both have short hash 0

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)

Hash collision between MalariBlock and  Beer: both have short hash 0

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)

Hash collision between Flake and  Beer: both have short hash 0

...
...
...

Hash collision between FoxArctic_Leather and  Beer: both have short hash 0

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)

Hash collision between Human_Leather and  Beer: both have short hash 0

(Filename: C:/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)


Additional infos:
- I have changed nothing in the load/save code from a14 to a15
- This was tested with a world created with only Core active -> saved -> mods activated -> load game -> errors
- Additional tests: - new world with all mods active -> saved -> load game -> errors
                           - new world with only two/three mods active -> saved -> load game -> no errors

- I have one mod where the one mod (+Misc Core) is enough to trigger it (Misc. incidents) but I can also trigger the errors without it active
- I have tested it a bit but can't find anything.

There is another report on this forum with this behaviour, but it can't be from my mods, as they weren't updated at the time of the first post.
https://ludeon.com/forums/index.php?topic=25161.0

[attachment deleted by admin - too old]

Haplo

Quote from: Tynan
Can you be clearer about what the problem is?

What does "load a game" mean precisely? Start the game? Activate the mod and leave the mods menu? Load a save that was saved without the mod? Load a save that was saved with the mod?

Anyway, this means that defs aren't getting given short hashes. The only reason for this I can think of is if someone does something weird with the PlayLoader and/or causes an exception during the PlayLoader load sequence.

With load a game I mean that I load the previously saved game. I have tested both variants:
1st I've saved a game with the mods active, then restarted and loaded it => error
      The variants with 2-3 mods (except my Incident mod) don't throw the error. But they do when I have more of my mods active.
2nd I've saved a game without any mods active, then activated the mods, restarted and loaded the save => error

But I'm not aware that I do something to the PlayLoader.
Doesn't the PlayLoader log if an error occured? Because the output_log doesn't contain anything at all that would hint to an error. Just the Hash-Collision error over and over. Nothing else.

I've uploaded the files to mediafire if you are interested:
http://www.mediafire.com/download/dndn24wpj2x7moq/RimWorld_HashCollision_Errors.7z

In here you'll find the output_log.txt file, two savegames (saved with and without mods) and two mods: my Misc Core and Misc Incidents.
If you activate the mods like this: (Core, Misc. Core, Misc. Incidents) you'll get the errors every time you load one of the saves.

Most likely I do something wrong in incidents and maybe one of the other mods, but what? I have no idea..

1000101

This bug is mod related but not caused by mods.  There is definitely an error in the core logic.  After several hours of digging the fellows in the modding slack finally found the source of the issue.  Fluffy is the one who actually found the problem code (skullywag and myself completely missed it).

Quote from: Fluffy (l2032) on August 31, 2016, 06:23:55 AM
the solution should be simple, in Verse.ShortHashGiver, the top lines should be change from


public static void GiveAllShortHashes()
{
ShortHashGiver.takenHashesPerDeftype.Clear();
List<Def> list = new List<Def>();
foreach (Type current in typeof(Def).AllLeafSubclasses())


to


public static void GiveAllShortHashes()
{
ShortHashGiver.takenHashesPerDeftype.Clear();
List<Def> list = new List<Def>();
foreach (Type current in typeof(Def).AllSubclasses())


That would create hashtables for abstract types, but they'd be empty anyway.
(2*b)||!(2*b) - That is the question.
There are 10 kinds of people in this world - those that understand binary and those that don't.

Powered By

Tynan

Thanks for the investigation info!

I've fixed this. I'll be releasing a hotfix version with this and some other fixes pretty soon.
Tynan Sylvester - @TynanSylvester - Tynan's Blog

Tynan

Fixed version is up on unstable branch. Please let me know (in the main General thread) if it solves this issue.
Tynan Sylvester - @TynanSylvester - Tynan's Blog