Hello all,
Since the merge #4, there is a problem at the destruction of the python interface used to interact with the SoT in some cases.
To reproduce the error, create the file test.py with the following content:
from dynamic_graph.sot.core.matrix_util import matrixToTuple
from dynamic_graph.sot.dynamics.angle_estimator import AngleEstimator
Running python ./test.py
Returns the following error:
*** glibc detected *** python: double free or corruption (fasttop): 0x00000000028b5870 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x7eb96)[0x7f964559db96]
/usr/lib/x86_64-linux-gnu/libstdc++.so.6(_ZNSsD1Ev+0x1f)[0x7f96433f751f]
/lib/x86_64-linux-gnu/libc.so.6(+0x3b901)[0x7f964555a901]
/lib/x86_64-linux-gnu/libc.so.6(+0x3b985)[0x7f964555a985]
/lib/x86_64-linux-gnu/libc.so.6(__libc_start_main+0xf4)[0x7f9645540774]
python[0x41bb31]
======= Memory map: ========
00400000-00670000 r-xp 00000000 08:06 4066903 /usr/bin/python2.7
00870000-00871000 r--p 00270000 08:06 4066903 /usr/bin/python2.7
00871000-008da000 rw-p 00271000 08:06 4066903 /usr/bin/python2.7
008da000-008ec000 rw-p 00000000 00:00 0
00951000-0100d000 rw-p 00000000 00:00 0 [heap]
...
(then there is the list of loaded libraries.)
This crash occurs because the library libsot-dynamic.so
is loaded after the library libsot-core.so
.
At the opposite, the following code will properly exit:
from dynamic_graph.sot.dynamics.angle_estimator import AngleEstimator
from dynamic_graph.sot.core.matrix_util import matrixToTuple
Note that this is only due to the fact that in dynamic_graph/sot/dynamics/__init__.py
, the Dynamic entity is the first one loaded. With this
from angle_estimator import AngleEstimator
from dynamic import Dynamic
the test would also crash.
Is there a way to correct this?
For now, I have to use a workaround that consists in systematically importing
from dynamic_graph.sot.dynamics.dynamic import Dynamic
first, so as to avoid this issue.