Server crash on invoking verse extention function to filter a map by a predicate function

Reference ID

f696699e-44e5-1cf1-a151-d2b25bfadf66

Please select what you are reporting on:

Verse

What Type of Bug are you experiencing?

Verse

Summary

In the supplied Island’s verse code, Invoking the extension function “FilterByPredicate” on a map appears to cause the server to crash in a test session.

Steps to Reproduce

Launch a session of the island via the UEFN editor and connect with a Fortnite client.

Expected Result

The client is not kicked from the island test session and the debugging code prints 1 through 4.

Observed Result

The client is kicked from the island session and the debugging code ceases printing at 2 (does not proceed past the invocation of the function “FilterByPredicate”)

Platform(s)

PC

Island Code

6240-5643-1746

Additional Notes

Potential offending code snippet:

(Map:[t_key]t_value where t_key:subtype(comparable), t_value:type).FilterByPredicate<public>(Predicate:type{_(:t_key, :t_value)<computes><decides>:void})<computes>:[t_key]t_value = 
{
    Pairs:[]tuple(t_key, t_value) = for (Key->Value:Map, Predicate[Key, Value]){Key, Value}
    CreateMap(Pairs)
}

CreateMap<public>(Pairs:[]tuple(t_key, t_value), (?Index:int = 0) where t_key:subtype(comparable), t_value:type)<computes>:[t_key]t_value =
{
    if (Pair := Pairs[Index]):
        ConcatenateMaps(map{Pair(0)=>Pair(1)}, CreateMap(Pairs, ?Index := Index + 1))
    else:
        map{}
}

I’m having trouble finding a crash for that island code. Can you look for a sessionId in your UEFN output window for a session where your get this server crash?

I tried that function locally, and it seems to work fine with small maps, although with non-small maps (e.g. 1000 keys) it triggered a runtime error due to hitting a recursion limit in CreateMap. There are some known problems with runtime errors not being reported to users before the server exits right now, so I suspect that might be what you’re seeing.

We’d eventually like to have a way to directly write a for that produces a map, but for now you could make CreateMap only require O(log N) deep recursion by making each recursion split the input in two instead of peeling off a single pair.

Could that recursion limit explain the crash you’re seeing?

Hello Andrew, thank you for following up.

I surmise this should be be the session ID?
LogValkyrieSummary: Connected to Session: 13b310cb0a8b4c8384cf991c50588608
I can repro the server becoming unresponsive immediately.

Re; recursion limits: I use a very small map (size 4) in the repro island/project, so I do not think it is a result of exceeding this limit. The cause of the crash as such may be due to other verse code in the project. I was chasing this particular crash occurring in a significantly larger codebase and had to duplicate then cut down the codebase in an attempt to chase the cause.

Please let me know if I can forward any other information to identify the issue.

Forgot to CC.
P.S. I had uploaded a private island version but had not launched into it before, hence why there were no crashes registered in your backend? I tested joining the private island and can confirm it also crashes. The session id should be
79a1299fef7a4247989ceeeb17aed16a

Thanks, I was able to find the crash reports from those session IDs.

We’ve already fixed the bug that I believe caused this based on a different repro, but the fix is not yet in the released build. Please let us know if you still see this problem in the next release.