Mutable compile hangs indefinitely when using Customizable Object Extension Data Constants

I am getting a CO compile to hang indefinitely while compiling. It seems to be caused by the optimization in LocalLogicOptimiserAST that tries to convert 3+ conditionals into a switch statement. It happens if you have 3 or more COs for an Object Group that are using a Customizable Object Extension Data Constant (for example, a Groom Constant). If I shut off this specific optimization, the issue goes away.

I thought I had added some steps to reproduce the issue, but in case they got lost, here they are:

  1. Create a Customizable Object called CO_Parent and open it up
  2. Add a mesh component node called Test and connect it to the Base Object’s Components input
  3. Add an Object Group node called Children, set its Type to “At least one option”, and connect it to the Base Object’s Children input
  4. Create a Customizable Object called CO_Child1 and open it up
  5. Click the Base Object, name it Child1, set its Attached to External Object to CO_Parent and select the Children group
  6. Create a Groom Constant node and attach it to the Groom input on the Base Object, compile and save
  7. Repeat steps 4 through 6 for CO_Child2 and CO_Child3
  8. Go back to CO_Parent and compile it and observe the hang

Hey there,

I’ve followed your repro excatly and was unable to create the hang in 5.6.1. Would you be able to setup a project with your files in the way they are setup?

Another thing that could help is providing a call stack of where you are at in LocalLogicOptimiser that was last called that could be causing the hang.

Dustin

Hi,

I was able to reproduce it following my reproduction steps on 5.6.0. I’ve attached the project. All you should have to do is open CO_Parent in the Mutable folder and you should see that it just gets stuck Compiling forever.

Thanks,

Chris

Got it, thanks for the repro. I’ve logged an issue that you can follow here: https://issues.unrealengine.com/issue/UE-350541

I’m checking with the dev team now to see what the result would be if we turn off that optimization as a workaround for you.

Dustin

Hello!

I’m seeing the same issue with the following setup:

  1. Create a base CO “Main” with a skeletal mesh component.
  2. Add a group to this CO, in my case called “Helmet”. Set the group to “One or None”.
  3. Create two other COs, attached to the Main one, on the Helmet object.
  4. In the Main CO, create another group, in my case called “Vest”. Also set to “One or None”.
  5. Again, create external COs attached to the Main, on the Helmet object.
  6. When the third external CO is added to the Helmet group, the Main CO will compile and hang.
  7. Attempting to save the asset will freeze the engine.

This has been happening consistently in a project that has basically a couple of meshes to try Mutable out.

EDIT: Running in Unreal Engine 5.7

EDIT: Follow-up after some investigation.

I enabled Mutable logs to see if I could find anything interesting in the output:

[Core.Log]
LogMutable=VeryVerbose
LogMutableCore=VeryVerbose

From there, I started seeing some very large iteration numbers from the Mutable Code Optimizer class, like an iteration number “46545”, whereas before adding the “third CO that freezes the compiler”, I’d see the optimization finishing after iteration “1”.

Verbose      LogMutableCore            State reoptimise iteration 46545, left 2147483638
Verbose      LogMutableCore             - semantic optimiser
Verbose      LogMutableCore             - size optimiser
Verbose      LogMutableCore             - constant optimiser
Verbose      LogMutableCore             - duplicated data remover
Verbose      LogMutableCore             - duplicated code remover

I don’t think it’s realistic to just sit and wait until it ends as I was sitting for 10 minutes to see and seemingly stuck at 50%.

So I decided to check if disabling the optimizer would help (for others reading this who want to try, you can disable the optimizer in the “three dots” labelled “Change Compile Options”, close to the “Compile buttons”, and then selecting “None” or “Minimal” for the Optimization Level.

As expected, disabling the optimizer will compile the CO without hanging. Everything seems to work as expected, but I get the warning saying that the CO was _Compiled without maximum optimization. Updates will be slower. This might be problematic for builds, but should be fine for dev cycles.

Now, if someone from Epic could clarify if this is a Mutable issue or user error, that’d be great! I hope you find the info useful.