-
-
Notifications
You must be signed in to change notification settings - Fork 21.1k
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
Calling MultiplayerAPI in a thread results in crashes. #79323
Comments
Multiplayer is only supported from the main thread, crash probably caused by manipulating the invalid result from |
I can't find any information in the docs of that being the case. Is that by design or just a long-standing issue? |
By design, see the linked issue APIs are non-thread safe unless stated otherwise, see here Including this:
|
Should probably be more clearly documented though |
Oh ok! It would have been useful to have that also in the MultiplayerAPI doc. |
To clarify, the crash comes not from the thread safety as such, but from accessing methods on Not a regression as the change to enforce thread safety was intentional, see #75901 Will take a look at documenting this fact Edit: Note that this crash would also happen if the node was not in the tree |
IMO, even if it's not possible it shouldn't crash, instead an error should be printed to console/output. |
The problem is that if you fetch the multiplayer and then call something on it how do you avoid a crash then? The returned value from You'll get an error but still a crash |
Calling things like I attempted to document this in the class reference but it wasn't approved, and didn't end up figuring out a good place to document it in the manual, but if someone could do that it'd be useful to add to it Had forgotten that the decision was to close this after the PR was closed but didn't end up happening, so will close this and if improving documentation in the manual is desired it can be tracked over in But there are plenty of other methods that return |
Godot version
4.1
System information
Godot v4.1.stable - Fedora Linux 38 (KDE Plasma) - Vulkan (Forward+) - integrated Intel(R) Xe Graphics (TGL GT2) () - 11th Gen Intel(R) Core(TM) i7-11370H @ 3.30GHz (8 Threads)
Issue description
Whenever a MultiplayerAPI call is made in a function running in a thread, that thread will crash.
Issues started occurring in 4.1 in all 4.0 releases this worked fine.
Steps to reproduce
Start a thread.
Call
multiplayer.get_unique_id()
in that function.The function will exit immediately.
NOTE: No debug information will be provided due to: #18330
Minimal reproduction project
multiplayer_thread_test.zip
The text was updated successfully, but these errors were encountered: