-
-
Notifications
You must be signed in to change notification settings - Fork 22.8k
Document some deadlocks in the physics server code #108495
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
base: master
Are you sure you want to change the base?
Conversation
@@ -136,6 +136,9 @@ void GodotSoftBody3D::set_mesh(RID p_mesh) { | |||
return; | |||
} | |||
|
|||
// TODO: calling RenderingServer::mesh_surface_get_arrays() from the physics thread | |||
// is not safe and can deadlock. This method blocks on the main thread to return data, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// is not safe and can deadlock. This method blocks on the main thread to return data, | |
// is not safe and can deadlock. This method blocks on the main thread to return data, |
@@ -128,6 +128,9 @@ bool JoltSoftBody3D::_ref_shared_data() { | |||
if (iter_shared_data == mesh_to_shared.end()) { | |||
RenderingServer *rendering = RenderingServer::get_singleton(); | |||
|
|||
// TODO: calling RenderingServer::mesh_surface_get_arrays() from the physics thread | |||
// is not safe and can deadlock. This method blocks on the main thread to return data, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// is not safe and can deadlock. This method blocks on the main thread to return data, | |
// is not safe and can deadlock. This method blocks on the main thread to return data, |
It seems pertinent to mention |
Add some comments documenting locations where PhysicsServer3D::soft_body_set_mesh() can deadlock. godotengine/godot-proposals#12670 has a proposal for some alternate thread-safe soft body APIs. In the meantime it seems worth at least documenting some of the current pitfalls in the code.
a04deb8
to
cb25b93
Compare
Applied the review feedback. |
Add some comments documenting locations where
PhysicsServer3D::soft_body_set_mesh()
can deadlock.godotengine/godot-proposals#12670 has a proposal for some alternate thread-safe soft body APIs. In the meantime it seems worth at least documenting some of the current pitfalls in the code.
Note that most people typically won't run into this deadlock today because they will crash in
PhysicsServer3D::soft_body_update_rendering_server()
first if trying to use SoftBody3D with a separate physics thread.