Skip to content

Remove the blocking Wait in CallInGodotMain#22

Open
Zoomulator wants to merge 1 commit intofledware:masterfrom
ludospex:call-in-godot-async
Open

Remove the blocking Wait in CallInGodotMain#22
Zoomulator wants to merge 1 commit intofledware:masterfrom
ludospex:call-in-godot-async

Conversation

@Zoomulator
Copy link
Contributor

Using a .net semaphore instead of godot's semaphore to be able to await with async rather than a blocking Wait. There wasn't any real reason not to use this to begin with, but there you go! :D

@rexfleischer I wasn't sure how to recreate the hang issues you mentioned here, so I hope you don't mind me leaving the testing up to you to see if it's been resolved!

@rexfleischer
Copy link
Member

Thanks! leaving the testing to me is fine. Maybe it's different for me because I'm on a mac.

@rexfleischer
Copy link
Member

rexfleischer commented Jul 16, 2023

@Zoomulator would you be willing to rebase from master and see if you can run the main project?

If you select GodotXUnit from the assembly selection and click "Run All Tests", it should run something like 15+ tests.

Using a .net semaphore instead of godot's to be able to
await with async rather than block.
@Zoomulator Zoomulator force-pushed the call-in-godot-async branch from 3883b77 to aadb971 Compare July 16, 2023 18:36
@Zoomulator
Copy link
Contributor Author

@rexfleischer It works! 🥳
image

@Zoomulator
Copy link
Contributor Author

@rexfleischer Hold on, the "IsNotInPhysicsProcess" fails sporadically

@rexfleischer
Copy link
Member

It still hangs for me after multiple runs in a row :(

@rexfleischer
Copy link
Member

Because of the threading changes in godot, maybe it's a good idea to entirely remove that feature from GodotXUnit and just use your threading changes.

@Zoomulator
Copy link
Contributor Author

@rexfleischer Yeah I think I've got the same behaviour as you. Which feature are you referring to? The physics frame should still be executed on the main godot thread as far as I'm aware, but yeah something is clearly not executing in a well behaved order.

@rexfleischer
Copy link
Member

The feature in GodotXUnit where you can run the test in the update or physics thread. If it's supposed to always be in the main thread now, then I think removing that ability is best.

@Zoomulator
Copy link
Contributor Author

I haven't looked into how that feature works exactly. AFAIK both _process and _phyics_process were called in the main Godot thread in v3.5. It's possible that _physics_process is called by another thread in 4.1 causing the issues now, but it's just a guess.

Anyway, the changes in this PR won't solve that, but I think it's a more correct version of the code I wrote so probably good to merge anyway?

@Zoomulator
Copy link
Contributor Author

Multithreaded node processing has been added to 4.1 but it's experimental and should be opt-in only, so I don't really know why we're having issues.

Perhaps open an issue and continue our investigation there?

@rexfleischer
Copy link
Member

I've tested this by removing the tests that I thought was hanging and it still hangs. I'll have to dive into the code and see where it's hanging to get a better idea of how to fix. But, this points to it not being a godot issue, more of an api usage issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants