Search Unity

Bug Unity 2021.3.16f1 editor crash when building assetbundle

Discussion in 'Editor & General Support' started by suntabu, Dec 30, 2022.

  1. suntabu

    suntabu

    Joined:
    Dec 21, 2013
    Posts:
    77
    As said in title, editor log shows below:

    Total compressed size 2.6 MB. Total uncompressed size 29.4 MB.
    Compiling shader "Spine/SkeletonGraphic Multiply" pass "Normal" (vp)
    StackOverflowException: The requested operation caused a stack overflow.
    at (wrapper managed-to-native) System.Array.CreateInstanceImpl(System.Type,int[],int[])
    at System.Array.CreateInstance (System.Type elementType, System.Int32[] lengths) [0x0008a] in <75633565436c42f0a6426b33f0132ade>:0
    at System.Array.CreateInstance (System.Type elementType, System.Int32 length) [0x0000b] in <75633565436c42f0a6426b33f0132ade>:0
    at System.MonoCustomAttrs.GetCustomAttributes (System.Reflection.ICustomAttributeProvider obj, System.Type attributeType, System.Boolean inherit) [0x001c9] in <75633565436c42f0a6426b33f0132ade>:0
    at System.RuntimeType.GetCustomAttributes (System.Type attributeType, System.Boolean inherit) [0x00038] in <75633565436c42f0a6426b33f0132ade>:0
    at UnityEditor.ShaderKeywordFilter.SettingsNode.GetConstraintAttributes (System.Reflection.ICustomAttributeProvider ap) [0x00001] in <a832b23c882249bd827d85de3e4878a5>:0
    at UnityEditor.ShaderKeywordFilter.SettingsNode.GatherFilterData (System.String nodeName, System.Object containerObject, UnityEditor.ShaderKeywordFilter.Constraints parentConstraints) [0x00019] in <a832b23c882249bd827d85de3e4878a5>:0
    at UnityEditor.ShaderKeywordFilter.SettingsNode.GatherFilterData (System.String nodeName, System.Object containerObject, UnityEditor.ShaderKeywordFilter.Constraints parentConstraints) [0x001f8] in <a832b23c882249bd827d85de3e4878a5>:0

    hundreds of:
    at UnityEditor.ShaderKeywordFilter.SettingsNode.GatherFilterData (System.String nodeName, System.Object containerObject, UnityEditor.ShaderKeywordFilter.Constraints parentConstraints) [0x001f8] in <a832b23c882249bd827d85de3e4878a5>:0

    then:
    =================================================================
    Native Crash Reporting
    =================================================================
    Got a UNKNOWN while executing native code. This usually indicates
    a fatal error in the mono runtime or one of the native libraries
    used by your application.
    =================================================================

    =================================================================
    Managed Stacktrace:
    =================================================================
    at <unknown> <0xffffffff>
    at UnityEditor.BuildPipeline:BuildAssetBundlesInternal <0x0010e>
    at UnityEditor.BuildPipeline:BuildAssetBundles <0x0029a>
    at UnityEditor.BuildPipeline:BuildAssetBundles <0x00342>
    at AssetBundleBrowser.AssetBundleDataSource.AssetDatabaseABDataSource:BuildAssetBundles <0x003ba>
    at AssetBundleBrowser.AssetBundleBuildTab:ExecuteBuild <0x016e9>
    at UnityEditor.EditorApplication:Internal_CallDelayFunctions <0x002df>
    at System.Object:runtime_invoke_void <0x00184>
    =================================================================
    Received signal SIGSEGV
    Obtained 2 stack frames
    RtlLookupFunctionEntry returned NULL function. Aborting stack walk.
    <Missing stacktrace information>


    I guess the recursive invoking of UnityEditor.ShaderKeywordFilter.SettingsNode.GatherFilterData has some bugs in it.
     
    Last edited: Jan 3, 2023
  2. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,196
    FWIW, I'm on 2021.3.16 as well, and I don't have any issues building asset bundles (via addressables). Have you tried removing that particular shader from your project to verify it's specifically crashing when trying to work with that shader? Maybe that's a place to start to track down what's going on?

    Given that it's a stack overflow, do you maybe have some kind of circular dependency in your bundles?
     
  3. ianhsiehxyz

    ianhsiehxyz

    Joined:
    Apr 13, 2022
    Posts:
    1
    We have this issue as well. Didn't find any circular dependency in our case.
     
  4. suntabu

    suntabu

    Joined:
    Dec 21, 2013
    Posts:
    77
    Thanks for your reply. I've tried another project without that shader and no crashing happened.

    I think there are some bugs in ShaderKeywordFilter.SettingsNode.GatherFilterData .

    When on Unity2021.3.10f1, nothing wrong in building asset bundles.
     
  5. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,196
    If you can throw that shader into a new project, and produce the crash you're finding in your main project, that would be a good sign. I'd recommend immediately filing a bug report in that case, if it's easy to reproduce in a sample project.
     
  6. suntabu

    suntabu

    Joined:
    Dec 21, 2013
    Posts:
    77
    Yes, it's straightforward to reproduce this problem in my project.

    And why I didn't file a bug report because unity's programmer always requests to upload my project and my project is huge, also I don't have enough time to create a demo for reproducing this error.

    I think this is a very simple error coding problem, I've reviewed the codes in UnityEditor.CoreModule.dll and found that just an error recursively invoking this method. It should be easy to be fixed.
     
  7. dgoyette

    dgoyette

    Joined:
    Jul 1, 2016
    Posts:
    4,196
    Well, it's obviously up to you. But I would have no confidence that this will necessarily get fixed unless you file a bug report. Hopefully it does, and maybe someone else already reported it for you. But for bugs I care about, I always submit a bug report, despite the pain of reproducing the error in a small sample project.
     
  8. suntabu

    suntabu

    Joined:
    Dec 21, 2013
    Posts:
    77
    From Unity2021.3.15f1 release notes:
    added this shader feature, but with bugs in it.
    upload_2023-1-6_11-35-26.png
     
  9. WojtaJ

    WojtaJ

    Joined:
    Apr 7, 2014
    Posts:
    1
    Hi, I had same crash during shader compilation in editor or during asset bundle build with Unity 2021.3.15+. It was in my code in custom scriptable render feature. If you are using scriptable render pipeline try to remove render features from your renderer.
     
  10. suntabu

    suntabu

    Joined:
    Dec 21, 2013
    Posts:
    77
    Thanks for your reply, I've also found that clue. but in our game, we must use this render feature.

    And I think there should be nothing wrong with the render feature when compiling shader, so this is a critical bug by unity.
     
  11. suntabu

    suntabu

    Joined:
    Dec 21, 2013
    Posts:
    77
  12. suntabu

    suntabu

    Joined:
    Dec 21, 2013
    Posts:
    77