### Tested versions - Reproducable in v4.7.2 (macos, but general issue reported by users on linux+windows) - *Not* reproducable in v4.6.stable ### System information Godot v4.6.stable - macOS Tahoe (26.6.2) - Multi-window, 1 monitor - OpenGL 3 (Compatibility) - Apple M1 Max - Apple M1 Max (10 threads) - 64.00 GiB memory (also reported on windows+linux) ### Issue description REPRO SYSTEM: OS: MacOS M1 Tahoe V26.6.2 (25G83) Godot v4.7.2 I was getting back some reports of my game (along with steam) stalling with low cpu usage and music still playing. Their log files tended to end with ``` ERROR: Condition "p_elem->_root" is true. at: add (./core/templates/self_list.h:46) ``` Looking into it more, I assembled a test case here that reproduces a hang https://github.com/increpare/torque_callback_repro the core of the problem for me seems to be calling apply_torque in _integrate_forces. calling state.apply_torque works fine. ``` func _integrate_forces(state: PhysicsDirectBodyState3D) -> void: calls += 1 if DIRECT_STATE: state.apply_torque(Vector3(0.1, 0.2, 0.3)) # safe else: apply_torque(Vector3(0.1, 0.2, 0.3)) # risk of stalling ``` here are some stats on how long it took to get to a stall in each test: ``` # v4.7.2 DIRECT_STATE=false, multithreaded physics=true: # run 1: frame ~14300 # run 2: frame ~4500 # run 3: frame ~100 # v4.7.2 DIRECT_STATE=true, multithreaded physics=false # run 1: reached FRAME_LIMIT without stall # run 2: reached FRAME_LIMIT without stall # run 3: reached FRAME_LIMIT without stall # v4.7.2 direct_state=false, multithreaded physics=false #1 reached FRAME_LIMIT without stall #2 reached FRAME_LIMIT without stall #3 reached FRAME_LIMIT without stall # 4.6.stable DIRECT_STATE false, multithreaded true #1 reached FRAME_LIMIT without stall #2 reached FRAME_LIMIT without stall #3 reached FRAME_LIMIT without stall ``` As you can see, it seems specific to 4.7, and specific to multithreaded being set to true. this is possibly related to #120941 ### Steps to reproduce Load the project and hit play in godot - it should reliably hang before it hits the limit. If you go to the settings menu and disable multithreaded physics, it should run to the end. OR if you set DIRECT_STATE to be true in main.gd. [I should say, my test case doesn't produce the stated error 'p_elem->_root', but it does produce a hang...] ### Minimal reproduction project (MRP) https://github.com/increpare/torque_callback_repro or here: [torque_callback_repro.zip](https://github.com/user-attachments/files/32434875/torque_callback_repro.zip)