[CRITICAL] Defer does not execute after cancellation through race

Summary

Here’s the repro

using { /Fortnite.com/Devices }
using { /Verse.org/Simulation }

test_device := class(creative_device):

    StartFail()<suspends>:void=
        Print("StartFail")
        defer:
            Print("StartFail Ended (from suspending scope)") # Never prints
        
        race:
            Sleep(Inf)
            Sleep(Inf)

        Sleep(Inf)

    StartSucceed()<suspends>:void=
        Print("StartSucceed")
        defer:
            Print("StartSucceed Ended (from suspending scope)") # Prints correctly
        
        # race:
        #     Sleep(Inf)
        #     Sleep(Inf)

        Sleep(Inf)

    OnBegin<override>()<suspends>:void=
        race:
            Sleep(1.0)
            StartFail()
            StartSucceed() # Not required to repro

Prints

[2024.10.20-13.59.20:863][673]LogVerse: : StartFail
[2024.10.20-13.59.20:864][673]LogVerse: : StartSucceed
[2024.10.20-13.59.21:854][790]LogVerse: : StartSucceed Ended (from suspending scope)

(As you can see the StartFail defer never fires, this is an issue when trying to build complex async structures)

Please select what you are reporting on:

Verse

What Type of Bug are you experiencing?

Verse

Steps to Reproduce

See summary

Expected Result

See summary

Observed Result

See summary

Platform(s)

PC

Can confirm it.

1 Like

I’d love to see this fixed!

3 Likes

It’s not fixed yet. I got the same issue. This is critical when using composed pattern with concurrency.

1 Like

FORT-807923 has been ‘Backlogged’. This is an issue that is in a queue to be addressed.

Me too!

2 Likes

Previous Enebz did not know about Verse, tell em

This gets fixed with the new VM. No plans to fix in BPVM.

2 Likes

Do we have a date for that or not seems very hush hush ?

You can check the roadmap

Doesn’t say a date. that said Q1 initially so i aint believing anything unless i see it or its confirmed.

It says Q3 Confidence: High, it should be coming soon at this point