Search Unity

[iOS] Asset bundle crash on decompression in Unity 5.3.1p3

Discussion in 'Editor & General Support' started by aixa, Jan 19, 2016.

  1. aixa

    aixa

    Joined:
    Sep 28, 2012
    Posts:
    46
    Hi,
    I'm having wierd problem with asset bundles. When I run game on iOS device, I get crash when the game is trying to load asset bundles from the cache, it gets stuck on DecompressAndStore().
    I have tried to use this function on Awake() - Caching.compressionEnabled = false, but still the error is the same.
    The game is working fine when it loads the asset bundles for the first time, but later it always crashes in some random places when I have unload them and try to load again.
    The same code is running without any problem on Unity 5.2 on iOS and with Unity 5.3 on windows standalone.

    I'm using Xcode 7.2 (7C68) with Unity 5.3.1p3 and this is logs I get from Xcode
    Code (CSharp):
    1. starting www download: file:///var/mobile/Containers/Bundle/Application/A7B54158-7738-48FC-8BE9-CAD1E1A7F607/myAwesomeGame.app/Data/Raw/AssetBundles/iOS/ui_elem/pausebtn
    2. Unable to open archive file for writing: '/var/mobile/Containers/Data/Application/D176270A-89CB-450F-9138-65D10296C097/Library/UnityCache/Temp/166b0508ba7b14d0bbed7209ead3f693/__data'
    3. (Filename: /Users/builduser/buildslave/unity/build/Runtime/VirtualFileSystem/ArchiveFileSystem/ArchiveStorageCreator.cpp Line: 51)
    4. Failed to decompress data for the AssetBundle 'file:///var/mobile/Containers/Bundle/Application/A7B54158-7738-48FC-8BE9-CAD1E1A7F607/myAwesomeGame.app/Data/Raw/AssetBundles/iOS/ui_elem/pausebtn'.
    5. (Filename: /Users/builduser/buildslave/unity/build/artifacts/generated/common/runtime/UnityEngineDebugBindings.gen.cpp Line: 37)
    6. starting www download: file:///var/mobile/Containers/Bundle/Application/34FAAB88-F896-48E2-942A-DDEC4B2518A4/myAwesomeGame.app/Data/Raw/AssetBundles/iOS/soundbanks/soundbank_ring.bnk
    7. starting www download: file:///var/mobile/Containers/Bundle/Application/34FAAB88-F896-48E2-942A-DDEC4B2518A4/myAwesomeGame.app/Data/Raw/AssetBundles/iOS/soundbanks/soundbank_start.bnk
    8. starting www download: file:///var/mobile/Containers/Bundle/Application/34FAAB88-F896-48E2-942A-DDEC4B2518A4/myAwesomeGame.app/Data/Raw/AssetBundles/iOS/soundbanks/soundbank_click.bnk
    9. myAwesomeGame was compiled with optimization - stepping may behave oddly; variables may not be available.
    and the callstack:

    Code (CSharp):
    1. (lldb) bt * thread #37: tid = 0xc8987, 0x00b268bc myAwesomeGame`::Lock() + 8 at VirtualFileSystem.cpp:733, stop reason = EXC_BAD_ACCESS (code=1, address=0x410)  
    2. frame #0: 0x00b268bc myAwesomeGame`::Lock() + 8 at VirtualFileSystem.cpp:733 [opt]  
    3. frame #1: 0x009146c8 myAwesomeGame`::OnArchiveStorageBlocksInfoProcessed() + 204 at AssetBundleLoadFromStreamAsyncOperation.cpp:69 [opt]
    4. * frame #2: 0x00b2c67a myAwesomeGame`::DecompressAndStore() + 58 at ArchiveStorageConverter.cpp:274 [opt]  
    5. frame #3: 0x00b2c9b2 myAwesomeGame`::ConversionThreadFunc() + 22 at ArchiveStorageConverter.cpp:194 [opt]  
    6. frame #4: 0x00b23e1a myAwesomeGame`::RunThreadWrapper() + 46 at Thread.cpp:40 [opt]  
    7. frame #5: 0x2206ec7e libsystem_pthread.dylib`_pthread_body + 138  
    8. frame #6: 0x2206ebf2 libsystem_pthread.dylib`_pthread_start + 110  
    9. frame #7: 0x2206ca08 libsystem_pthread.dylib`thread_start + 8
    If you need any extra information just let me know.
    Thanks for any help
     
  2. pahe

    pahe

    Joined:
    May 10, 2011
    Posts:
    543
    Looks like you download your bundles from the disk? Have a look here. Anyway, the WWW class is pretty broken in 5.3.1. If you can, revert to 5.2. If you're stuck, like us, wait for the patch I would suggest.

    For iOS problems, you should definitely post in the iOS forum for better help :)
     
    aixa likes this.
  3. aixa

    aixa

    Joined:
    Sep 28, 2012
    Posts:
    46
    Thanks for the link, I will check if this helps.
    Yes, I'm trying to load from the disc, so it definitely might be problem with the WWW class.

    We still have working game in 5.2, but in 5.3 were some useful features for us, so I hope we get it working ( or we get working patch) :)
     
  4. aixa

    aixa

    Joined:
    Sep 28, 2012
    Posts:
    46
    Ok, so the issue is the www class. When I load asset bundles with function WWW.LoadFromCacheOrDownload() for the first time it works, but when the code is trying to get them from cache - isDone is never called and app gets stuck and crashes. Hope the fix will come in latest patch
     
  5. Mantas-Puida

    Mantas-Puida

    Joined:
    Nov 13, 2008
    Posts:
    1,864
    Please submit a bug report and share your case number.
    Thanks!
     
  6. memetic-arts

    memetic-arts

    Joined:
    Feb 27, 2011
    Posts:
    82
    Did this get fixed? Having a similar problem, but not loading from disc. And for me, it hangs the first time, always works the second time. To the point that I've inserted an extra call before looping through the AB calls.
     
  7. pahe

    pahe

    Joined:
    May 10, 2011
    Posts:
    543
    For us it works fine: loading from disk and standard WWW requests on all platforms with 5.3.4f1. Haven't tested redirected calls though.