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

Deadlock in BulletBodyNode::add_shapes_from_collision_solids() #689

Open
PointSource-xx opened this issue Jul 21, 2019 · 2 comments · May be fixed by #696

Comments

@PointSource-xx
Copy link
Contributor

commented Jul 21, 2019

#0  __lll_lock_wait () at ../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:103
#1  0x00007f2399e24945 in __GI___pthread_mutex_lock (mutex=0x7f2393c126e0 <BulletWorld::get_global_lock()::lock>) at ../nptl/pthread_mutex_lock.c:80
#2  0x00007f2393be4cd9 in MutexPosixImpl::lock() () from /usr/lib/x86_64-linux-gnu/panda3d/libpandabullet.so.1.10
#3  0x00007f2393bd2829 in BulletRigidBodyNode::transform_changed() [clone .part.1630] () from /usr/lib/x86_64-linux-gnu/panda3d/libpandabullet.so.1.10
#4  0x00007f2397d9acab in PandaNode::set_transform(TransformState const*, Thread*) () from /usr/lib/x86_64-linux-gnu/panda3d/libpanda.so.1.10
#5  0x00007f2397d13d80 in NodePath::set_scale(LVecBase3f const&) () from /usr/lib/x86_64-linux-gnu/panda3d/libpanda.so.1.10
#6  0x00007f2393bd07c5 in BulletBodyNode::do_add_shape(BulletShape*, TransformState const*) () from /usr/lib/x86_64-linux-gnu/panda3d/libpandabullet.so.1.10
#7  0x00007f2393bd1317 in BulletBodyNode::add_shapes_from_collision_solids(CollisionNode*) () from /usr/lib/x86_64-linux-gnu/panda3d/libpandabullet.so.1.10
#8  0x00007f2393c8d6ca in Dtool_BulletBodyNode_add_shapes_from_collision_solids_90(_object*, _object*) () from /usr/lib/python3/dist-packages/panda3d/bullet.cpython-37m-x86_64-linux-gnu.so
#9  0x00000000004d7d11 in _PyMethodDescr_FastCallKeywords ()
#10 0x0000000000552313 in _PyEval_EvalFrameDefault ()
#11 0x000000000054b9f2 in _PyEval_EvalCodeWithName ()
#12 0x00000000005d8c62 in _PyFunction_FastCallKeywords ()
#13 0x000000000054e3dc in _PyEval_EvalFrameDefault ()
#14 0x000000000054b9f2 in _PyEval_EvalCodeWithName ()
#15 0x00000000005d8c62 in _PyFunction_FastCallKeywords ()
#16 0x000000000054af20 in ?? ()
#17 0x000000000054f0ee in _PyEval_EvalFrameDefault ()
#18 0x00000000005d9ca6 in _PyFunction_FastCallDict ()
#19 0x0000000000591103 in ?? ()
#20 0x00000000005d93c9 in _PyObject_FastCallKeywords ()
#21 0x00000000005523b6 in _PyEval_EvalFrameDefault ()
#22 0x00000000005d896c in _PyFunction_FastCallKeywords ()
#23 0x000000000054e3dc in _PyEval_EvalFrameDefault ()
#24 0x00000000005d9ca6 in _PyFunction_FastCallDict ()
#25 0x0000000000591103 in ?? ()
#26 0x00000000005d93c9 in _PyObject_FastCallKeywords ()
#27 0x00000000005523b6 in _PyEval_EvalFrameDefault ()
#28 0x00000000005d9ca6 in _PyFunction_FastCallDict ()
#29 0x0000000000591103 in ?? ()
#30 0x00000000005d93c9 in _PyObject_FastCallKeywords ()
#31 0x00000000005523b6 in _PyEval_EvalFrameDefault ()
#32 0x000000000054b9f2 in _PyEval_EvalCodeWithName ()
#33 0x000000000054dd33 in PyEval_EvalCode ()
#34 0x0000000000630f22 in ?? ()
#35 0x0000000000630fd7 in PyRun_FileExFlags ()
#36 0x0000000000631c3f in PyRun_SimpleFileExFlags ()
#37 0x000000000065414e in ?? ()
#38 0x00000000006544ae in _Py_UnixMain ()
#39 0x00007f2399e60b6b in __libc_start_main (main=0x4bc950 <main>, argc=2, argv=0x7ffd68404af8, init=<optimised out>, fini=<optimised out>, rtld_fini=<optimised out>, stack_end=0x7ffd68404ae8)
    at ../csu/libc-start.c:308
#40 0x00000000005e04ea in _start ()

@PointSource-xx PointSource-xx changed the title Deadlock in `BulletBodyNode::add_shapes_from_collision_solids()` Deadlock in BulletBodyNode::add_shapes_from_collision_solids() Jul 21, 2019

@rdb rdb added the bullet label Jul 21, 2019

@rdb

This comment has been minimized.

Copy link
Member

commented Jul 21, 2019

do_add_shape changes the node transform, which calls transform_changed, which tries to grab the lock again.

We may need to add a version of PandaNode::set_transform that doesn't call transform_changed.

@PointSource-xx

This comment has been minimized.

Copy link
Contributor Author

commented Jul 21, 2019

do_add_shape is only dealing with shapes, is it not possible to copy in something like:

for (BulletShape *shape : _shapes) {
          shape->do_set_local_scale(1.0);
        }

(from BulletGhostNode::do_transform_changed) to undo later?

PointSource-xx added a commit to PointSource-xx/panda3d that referenced this issue Jul 31, 2019
bullet: replace NodePath scaling in BulletBodyNode::add_shapes_from_c…
…ollision_solids()

Use btCollisionShape::[get|set]LocalScaling() instead of scaling the NodePath when adding new shapes to avoid a circular deadlock on the BulletWorld global lock. Fixes panda3d#689.
PointSource-xx added a commit to PointSource-xx/panda3d that referenced this issue Jul 31, 2019
bullet: replace NodePath scaling in BulletBodyNode::add_shapes_from_c…
…ollision_solids()

Use btCollisionShape::[get|set]LocalScaling() instead of scaling the NodePath when adding new shapes to avoid a circular deadlock on the BulletWorld global lock. Fixes panda3d#689.
PointSource-xx added a commit to PointSource-xx/panda3d that referenced this issue Jul 31, 2019
bullet: replace NodePath scaling in BulletBodyNode::do_add_shape()
Use btCollisionShape::[get|set]LocalScaling() instead of scaling the NodePath when adding new shapes to avoid a circular deadlock on the BulletWorld global lock. Fixes panda3d#689.
PointSource-xx added a commit to PointSource-xx/panda3d that referenced this issue Aug 9, 2019
bullet: replace NodePath scaling in BulletBodyNode::do_add_shape()
Use btCollisionShape::[get|set]LocalScaling() instead of scaling the NodePath when adding new shapes to avoid a circular deadlock on the BulletWorld global lock. Fixes panda3d#689.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.