Hi, I am using panda as a collision engine in a server side world simulation.
Right now It only calculates the z position with get_elevation.
I was using get_sz from the root to get the z scale, and found out that this method was not thread safe.
After a few connections (which run on several threads) I received the error:
Assertion failed: (_flags & F_lock_count) != 0 at line 68 of panda/src/pipeline/mutexSimpleImpl.I
Assertion failed: _lock_count > 0 at line 175 of panda/src/pipeline/reMutexDirect.cxx
Assertion failed: _lock_count == 1 at line 49 of panda/src/pipeline/reMutexDirect.cxx
Assertion failed: _lock_count > 0 at line 175 of panda/src/pipeline/reMutexDirect.cxx
Assertion failed: _lock_count > 0 at line 56 of panda/src/pipeline/reMutexDirect.cxx
Assertion failed: _lock_count > 0 at line 175 of panda/src/pipeline/reMutexDirect.cxx
Assertion failed: _lock_count > 0 at line 56 of panda/src/pipeline/reMutexDirect.cxx
Assertion failed: _lock_count > 0 at line 175 of panda/src/pipeline/reMutexDirect.cxx
Assertion failed: _lock_count > 0 at line 56 of panda/src/pipeline/reMutexDirect.cxx
Assertion failed: _lock_count > 0 at line 175 of panda/src/pipeline/reMutexDirect.cxx
Assertion failed: _lock_count > 0 at line 56 of panda/src/pipeline/reMutexDirect.cxx
Assertion failed: _lock_count > 0 at line 175 of panda/src/pipeline/reMutexDirect.cxx
Assertion failed: _lock_count > 0 at line 56 of panda/src/pipeline/reMutexDirect.cxx
Assertion failed: _lock_count > 0 at line 175 of panda/src/pipeline/reMutexDirect.cxx
Assertion failed: _lock_count > 0 at line 56 of panda/src/pipeline/reMutexDirect.cxx
Assertion failed: _lock_count > 0 at line 175 of panda/src/pipeline/reMutexDirect.cxx
Assertion failed: _lock_count > 0 at line 56 of panda/src/pipeline/reMutexDirect.cxx
Assertion failed: _lock_count > 0 at line 175 of panda/src/pipeline/reMutexDirect.cxx
Assertion failed: _lock_count > 0 at line 56 of panda/src/pipeline/reMutexDirect.cxx
:thread(error): Deadlock! All threads blocked.
Segmentation fault (core dumped)
Running on GDB:
#0 0x00007fa370fe7b1e in ThreadSimpleManager::next_context() () from /usr/lib64/panda3d/libpanda.so.1.7
No symbol table info available.
#1 0x00007fa370be9c8a in TransformState::unref() const () from /usr/lib64/panda3d/libpanda.so.1.7
No symbol table info available.
#2 0x00007fa370ac20f9 in ConstPointerTo<TransformState>::~ConstPointerTo() () from /usr/lib64/panda3d/libpanda.so.1.7
No symbol table info available.
#3 0x00007fa370b066fe in NodePath::get_scale() const () from /usr/lib64/panda3d/libpanda.so.1.7
No symbol table info available.
#4 0x0000000000404597 in NodePath::get_sz (this=<value optimized out>, x=<value optimized out>, y=<value optimized out>) at /usr/include/panda3d/nodePath.I:809
No locals.
#5 Terrain::calcZ (this=<value optimized out>, x=<value optimized out>, y=<value optimized out>) at /home/fernando/Documents/project/server/collision.cpp:18
I saved the zScale in a variable and I am using it instead of invoking the method. Still I am wondering, is get_elevation thread safe? Any other functions I should take care? Any panda_thread I could use instead of the default pthread?
Thanks in advance.
[/code]