Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Bug Update catalogs operation is invalid after clean cache operation

Discussion in 'Addressables' started by llFlexford, May 31, 2023.

  1. llFlexford

    llFlexford

    Joined:
    Jan 21, 2022
    Posts:
    24
    Rquirements:
    • Unity 2021.3.19
    • Addressables 1.21.10

    I found problem when update catalogs operation return previous resources locators, but i awaiting new locators relative new catalog from server;
    I spend 3 days for understand what is reason of this problem, I checked every addressables operations(check, update and clean) code line in debugger, it was difficult....

    Playback steps:
    • disable auto-update catalogs is settings
    • start game
    • execute update catalogs sequence(i did specially sequence for get bool result about update catalogs):
      • start Addressables.CheckForCatalogUpdates(true)
      • addressables will auto-initialized if didn't initialized early
      • create chain op from previous, next op:
        • if check op return not null catalogs names - return Addressables.UpdateCatalogs(handle.Result, true);
        • else - return completed operation with result (List<IResourceLocator>)null
      • create chain op from previous, nex op:
        • if previous result is null - return false
        • else - return true
      • in backward order release all handles(I read about cache warning in documentation: https://docs.unity3d.com/Packages/c...1/manual/runtime/LoadContentCatalogAsync.html)
    • all right, catalogs updated, locators created, internal aa cache hasn't group operation with catalog.json(IT'S IMPORTANT)
    • if we will update catalogs on server N times - all right, catalogs correctly updated, and i everytime i get new valid resources locators and result of my sequence is 'true'
    • after next steps will bug
    • execute clean cache operation - Addressables.CleanBundleCache();
      • internal unity code add new group operation with catalog.json in internal operations cache(IT'S IMPORTANT) This group operation will removed only if clean cache operation will failed! If success, group operation stay in cache!
    • when clean cache operation completed - I release operation handle, provider operation will destroyed, and other dependencies but operation was successful and group operation stay in internal operations cache.
    • execute my previous update catalogs sequence:
      • first step 'Addressables.CheckForCatalogUpdates(true)' return correct result with main catalog name, and before this I seen in debugger what from server was received new catalog.hash with new different hash!
      • second step 'Addressables.UpdateCatalogs(handle.Result, true)' return previous resources locators, because this operation try create group operation, but it's already have in internal cache after clean cache operation. After that, 'update catalogs operation' got previous cached group operation with previous resources locators as result.
      • third step 'convert array to bool' - return true, array is not null or empty
    • by boolean result - catalogs updated, but it's not true, we have previous resources locators
    • all next update catalogs sequences will be with the same result
    • for correct update catalogs i cant' use "clean cache operation", else after "clean cache operation" need full reload application, but it's bullshit
     
  2. llFlexford

    llFlexford

    Joined:
    Jan 21, 2022
    Posts:
    24
    Forgot: between update catalogs sequences I really update catalogs and bundles on server and every time I must get new resources locators with new(updated) bundles locations
     
  3. llFlexford

    llFlexford

    Joined:
    Jan 21, 2022
    Posts:
    24
    I implemented 2 temp workarounds:
    1) Use Caching.ClearCache instead CleanBundlesCacheOperation
    2) After start Addressables.CleanBundleCache, get from handle by reflection inner operation, get dependencies from inner operation and relese they additionaly after complete Addressables.CleanBundleCache