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

Infinite loop in Physics2DServerSW::_update_shapes with Multi-Threaded physics #35017

Open
Tracked by #45334
DrMoriarty opened this issue Jan 11, 2020 · 9 comments
Open
Tracked by #45334

Comments

@DrMoriarty
Copy link
Contributor

DrMoriarty commented Jan 11, 2020


Bugsquad note: This issue has been confirmed several times already. No need to confirm it further.


Godot version:
Godot 3.2.beta 6 (commit 02cd144)

OS/device including version:
MacOSX 10.14.6 (18G95)

Issue description:

I have a lot of KinematicBody2D in one scene. In _physics_process I call move_and_collide and some times the game hungs up with logs:

ERROR: remove: Condition ' p_elem->_root != this ' is true.
   At: ./core/self_list.h:84.

This lines repeates many times. Actually infinite amount of times, because it prints from the infinite loop.

I catched the bug with xcode debugger and it shows me that the problem is in void Physics2DServerSW::_update_shapes():

pending_shape_update_list.remove(pending_shape_update_list.first());

I have no ideas why pending_shape_update_list became broken. Does anybody have?

Steps to reproduce:

Minimal reproduction project:

@DrMoriarty
Copy link
Contributor Author

Also I double checked that all my object manipulations was in physics frame. Also set all timer and tweens to physics process mode.

@akien-mga akien-mga added this to the 3.2 milestone Jan 11, 2020
@DrMoriarty
Copy link
Contributor Author

The bug only reproduced in multi-threaded physics. When I set physics/2d/thread_model to Single-Safe all works as expected.

@Xrayez
Copy link
Contributor

Xrayez commented Jan 11, 2020

I recently tested similar multi-threaded physics issue in #29369 (comment).

@creikey
Copy link
Contributor

creikey commented Jan 17, 2020

Perhaps a read-write lock could be used to mitigate this issue on the pending shape update list? As I cannot reliably reproduce I can't test.

@akien-mga akien-mga changed the title Infinite loop in Physics2DServerSW::_update_shapes Infinite loop in Physics2DServerSW::_update_shapes with Multi-Threaded physics Jan 23, 2020
@akien-mga akien-mga modified the milestones: 3.2, 4.0 Jan 23, 2020
@KoBeWi
Copy link
Member

KoBeWi commented Dec 18, 2020

Can anyone still reproduce this bug in Godot 3.2.3 or any later release?

If yes, please ensure that an up-to-date Minimal Reproduction Project (MRP) is included in this report (a MRP is a zipped Godot project with the minimal elements necessary to reliably trigger the bug). You can upload ZIP files in an issue comment with a drag and drop.

@yuraj11
Copy link

yuraj11 commented Mar 1, 2021

I am still getting similar issue (v3.2.4.rc.mono.custom_build.4b9b9ed2f), multi-thread rendering is on:
ERROR: SelfList<class CollisionObject2DSW>::List::remove: Condition "p_elem->_root != this" is true. (core/self_list.h:84)
happens randomly when trying to call .instance() on scene which contains physics body (in my case KinematicBody2D) in thread (C#).

EDIT: Well it doesn't happen with physics Multi-Threaded option for me.

@Reapetitive
Copy link

Reapetitive commented Sep 23, 2021

I still get this problem in 3.3.3, even with single-safe. With multi-threaded it happens way more often. I use many kinematic bodies.

@hodgerti
Copy link

hodgerti commented Dec 5, 2021

I am having this issue on 3.3.4-stable, but resolved it by switching from Multi-Threaded Physics thread model to Single-Safe.

Here is a visual studio minidump:
_update_shapes-bug-godot.windows.tools.64.dmp.zip

@rburing
Copy link
Member

rburing commented Feb 22, 2023

Somebody please attach a reproduction project. From the information so far it seems to be a 3.x issue, so I'm changing the milestone. If it is reproducible in 4.0 then please let us know (with a reproduction project).

@rburing rburing modified the milestones: 4.0, 3.6 Feb 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

10 participants