I believe this problem only happens when the mouse, while holding the sword, moves outside the viewport and then moves inside again. I don't know what internal processes are happening in the physics engine to make this weird glitch, but when you go fullscreen the issue is not present anymore (since the mouse can't leave the viewport), so maybe it is not a big problem.
I couldn't find a way to solve it though, I'm sorry about that.