Search Unity

Randomized non-reproducible hashes in asset bundle names

Discussion in 'Addressables' started by stopiccot_tds, Aug 21, 2019.

  1. stopiccot_tds

    stopiccot_tds

    Joined:
    Oct 1, 2016
    Posts:
    111
    We are currently getting familiar with addressables package in our project. Version 1.1.7.
    Seems like hashes in asset bundle names are randomized and are not reproducible.
    Steps to reproduce:

    1. Clean repo by running git clean -xdf && git reset --hard
    2. Do a fresh project import with iOS target
    3. Click to Build Player Content
    4. downloadablegroup_assets_all_b489b444bcd325a8957ba52060eb1e0d.bundle file is created
    5. Clean, import and build once again
    6. downloadablegroup_assets_all_311bc64f0f43adf17aae3842cf53e52d.bundle file is created

    To be honest this is very annoying.
     
  2. unity_bill

    unity_bill

    Joined:
    Apr 11, 2017
    Posts:
    1,053
    I am fairly confident that the issue is the "import" you are doing, not addressables. There are a few importers that are non deterministic. On top of that, there are quite a few ways your project code can cause non-determinism. Custom importers in your project, hooks in the import process, or hooks in the scene build process, to name the main ones.

    If you are sure it's addressables doing something bad, please open a Unity bug with a repro project.
     
  3. stopiccot_tds

    stopiccot_tds

    Joined:
    Oct 1, 2016
    Posts:
    111
    @unity_bill Thanks for the response. We are not using any custom importers or build process hooks in our project. Anyway I would like to check this myself first. Could you please tell me addressables (scriptable build pipeline?) classes where asset bundle hash is calculated so I can debug it?
     
  4. stopiccot_tds

    stopiccot_tds

    Joined:
    Oct 1, 2016
    Posts:
    111
    I've managed to narrow down the issue to ContentBuildInterface.WriteSerializedFile() call inside AssetBundleWriteOperation class. In my case Command.serializeObjects contains 1915 objects and their serializationIndex/localIdentifierInFile/guid field do not change between fresh imports. Generated by WriteSerializedFile() call file is named CAB-3b59866ebe196603ffe6e64073b996ea.resS and is always
    16527120 bytes in size. File size does not change between fresh imports. But the file contents do change between fresh imports. So looks like for the same serializeObjects list different but equal in size resS files are generated. How can I debug this futher? Maybe I can somehow dump contents for serializeObject on per-object basis?
     
  5. nik_d

    nik_d

    Joined:
    Apr 27, 2018
    Posts:
    66
    As I understand via hash calculation in ArchiveAndCompressBundles.cs :
    CAB-xxxx *with* extension resS contains raw data (e.g. texture content, geometry or animation streams, etc) because serialised objects are built into CAB-xxxx *without* extension.

    I always meet difference in hash of texture when it's built in different OS, but sometime hash changed even on the same build agent (with disabled unity cache server).
    If you narrow down to the type of indetermined data - tell please. It's interesting, because currently to minimize changes I must build bundles in only one build agent with local cache server enabled.:(
     
  6. stopiccot_tds

    stopiccot_tds

    Joined:
    Oct 1, 2016
    Posts:
    111
    Hey @unity_bill Can you please help me with this issue?
     
  7. stopiccot_tds

    stopiccot_tds

    Joined:
    Oct 1, 2016
    Posts:
    111