Sync in a loop can suspend forever if its first block doesn't suspend

Summary

Here’s the repro

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
test_device := class(creative_device):

    FakeSuspends()<suspends>:void=
        Print("FakeSuspends")

    OnBegin<override><final>()<suspends>:void=
        Print("BEFORE")
        loop:
            Print("A")
            sync:
                FakeSuspends()
                Sleep(0.0)
            Print("B")
        Print("AFTER")
        # Will print BEFORE / A / FakeSuspends / B / A / FakeSuspends and then nothing anymore

Here the script is supposed to Print in a loop but it stops after the 2nd iteration (no crash, it just suspends forever)

Swapping the two statements makes it work as intended

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }
test_device := class(creative_device):

    FakeSuspends()<suspends>:void=
        Print("FakeSuspends")

    OnBegin<override><final>()<suspends>:void=
        Print("BEFORE")
        loop:
            Print("A")
            sync:
                Sleep(0.0) # Swapped
                FakeSuspends() # Swapped
            Print("B")
        Print("AFTER")
        # Will print BEFORE / (A / FakeSuspends / B) * infinite (as intended)

Please select what you are reporting on:

Verse

What Type of Bug are you experiencing?

Verse

Steps to Reproduce

See the repro above

Expected Result

See the repro

Observed Result

See the repro

Platform(s)

PC

We’ll get someone to take a look.

1 Like

The status of FORT-805504 incident has been moved from ‘Needs Triage’ to ‘To Do’.

1 Like