Announcement

Collapse
No announcement yet.

Loop made from Custom Events incorrectly flagged as infinite loop.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Loop made from Custom Events incorrectly flagged as infinite loop.

    Click image for larger version  Name:	bloop.png Views:	2 Size:	278.7 KB ID:	1686065


    This loop should never fire infinitely. However, if you call it in PIE it throws an infinite loop detected error. If you call it in editor, it will just add 118 integers to Int Array then quit, when it should add 200 elements to Int Array (4 sets of 0-49). What's going on here?

    I attached a copy of the uasset if anyone wants to drop it into their content folder to test it out.

    Edit:

    Okay now check this out. Instead of calling the custom events I instead connected the wire's directly into the nodes flow that they call. And now it no longer is detected as an infinite loop and the Array is filled as expected.

    Click image for larger version

Name:	bloop2.png
Views:	84
Size:	183.4 KB
ID:	1686197
    so I guess spaghetti is on the menu
    Attached Files
    Last edited by JayRockets; 11-12-2019, 04:51 PM.

    #2
    It is actually not infinite loop. Blueprint recurse limit exception. Changing max inner loop index to small(10<) it works expected.

    ScriptCore.cpp
    Code:
    DEFINE_FUNCTION(UObject::ProcessInternal)
    {
    ...
            else if (++FBlueprintExceptionTracker::Get().Recurse == RECURSE_LIMIT)
            {
                // If we have a return property, return a zeroed value in it, to try and save execution as much as possible
                UProperty* ReturnProp = (Function)->GetReturnProperty();
                ClearReturnValue(ReturnProp, RESULT_PARAM);
    
                // Notify anyone who cares that we've had a fatal error, so we can shut down PIE, etc
                FBlueprintExceptionInfo InfiniteRecursionExceptionInfo(
                    EBlueprintExceptionType::InfiniteLoop,
                    FText::Format(
                        LOCTEXT("InfiniteLoop", "Infinite script recursion ({0} calls) detected - see log for stack trace"),
                        FText::AsNumber(RECURSE_LIMIT)
                    )
                );
    
    ...

    On PLATFORM_DESKTOP recurse limited to 250. I think every blueprint node's recurse counted(250>), event thought IntArray 118.
    Code:
    #if !PLATFORM_DESKTOP
        #define RECURSE_LIMIT 120
    #else
        #define RECURSE_LIMIT 250
    #endif
    Last edited by empty2fill; 11-13-2019, 12:54 AM.

    Comment


      #3
      I am able to change max Inner Loop index to 100 and Outer to 10 and successfully add 1,000 elements to the array using the method in the second pic. So it is just calling custom events that has a recursive limit?

      Comment


        #4
        Originally posted by JayRockets View Post
        I am able to change max Inner Loop index to 100 and Outer to 10 and successfully add 1,000 elements to the array using the method in the second pic. So it is just calling custom events that has a recursive limit?
        Yes. UObject::ProcessInternal called on custom event. I don't know why FBlueprintExceptionTracker::Get().Recurse != loop custom event call count.

        Comment

        Working...
        X