Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Hotloading: Async method marked as completed too early #7098

Open
DevulTj opened this issue Dec 2, 2024 · 3 comments
Open

Hotloading: Async method marked as completed too early #7098

DevulTj opened this issue Dec 2, 2024 · 3 comments
Assignees

Comments

@DevulTj
Copy link
Member

DevulTj commented Dec 2, 2024

Describe the bug

I noticed it if you hotload sometimes (it's not 100%, but if you spam save on a file a few times you'll notice it on an empty project)

To Reproduce

  1. Open attached project
  2. Open in play mode
  3. Notice "Before Test" text in the console
  4. If you hotload a few times, you will notice "After Test" will run before the 30 seconds timer is up.

Expected behavior

Should maintain state

Media/Files

async_hotloading_test.zip

Additional context

No response

@DevulTj
Copy link
Member Author

DevulTj commented Dec 2, 2024

I'm also gonna note here that the same issue seems to happen when performing host migration - which makes sense. I've not looked too much into it though, I don't see how we'd make it work really.

@Metapyziks Metapyziks moved this from To triage to In progress in s&box tracker Dec 2, 2024
@Metapyziks
Copy link

Thanks for the repro. Looks like Time.Now jumps occasionally, maybe Task.DelayInternal() continues in the wrong Time.Scope().

@Metapyziks
Copy link

Yeah we're pumping the main thread sync context continuation queue at a few points during hotload.

I think this is exposing a bigger problem, there will be continuations in there for both editor and game tasks, with different scene and / or time scopes. Either we should have separate SyncContexts for editor vs game, or capture things like the active scene when posting to a sync context. I'm going to mock up the latter because it should be a smaller change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In progress
Development

No branches or pull requests

2 participants