Segfaults with boost::python::tuple during simulation loop
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Yade |
Fix Released
|
Undecided
|
Unassigned |
Bug Description
Hi,
I'm currently facing segmentation fault when using "my" MeasureCapStress post-processing engine (this constitutes a regression..).
A example script appears at the end of this message (it's better, though not necessary here, to have the capillary files from https:/
There is some random pattern in the way crashs occur, with e.g. the following messages:
- *** Error in `/usr/bin/python': free(): invalid pointer: 0x00000000008fa220 ***
followed by plenty of "Backtrace" and "Memory map" lines ending with "Aborted (core dumped)"
- or just "Segmentation fault (core dumped)"
that appear after a variable number (not much, though) of iterations.
It seems also possible to go through a greater number of iterations by hand-clicking on GUI step button than by asking O.run()...
Anyway, the crash seems to occur during (or just after) the definition of a boost::
I'm quite puzzled by all this, would someone have an idea ?
Is there any particular (de-allocating ?) practice to follow when using such Python-C interfaced variables in the C++ code ?
Thank you very much,
Jerome
### Script example ###
# two contacting particles with a capillary bridge inbetween. Segfaults because of MeasureCapStress on my machine
r1,r2 = 1e-4,4e-4
z1,z2=0,
O.bodies.
O.bodies.
O.engines=
]
O.run()
### End of script example ###
[*] https:/
summary: |
- MeasureCapStress-caused segmentation fault (boost::python) + Segfaults with boost::python::tuple during simulation loop |
Hi Jérôme, python: :extract( something) but the "something" is already an ordinary c++ double hence the extract is useless. python: :extract is probably what you need but it should come earlier when extracting the Vector3r.
It seems related to manipulating this python tuple as a c++ object.
First, I did not see any "[]" operator for tuples in boost documentation.
Second, even if it works I'm unsure it will automatically return the correct type (a Vector3r), hence this syntax may not do what you think:
double V = tuple[i][j]
Third, you incuded a boost::
boost::
Just my guess. I hope it helps.
Bruno
https:/ /www.boost. org/doc/ libs/1_ 66_0/libs/ tuple/doc/ html/tuple_ users_guide. html /www.boost. org/doc/ libs/1_ 48_0/libs/ python/ doc/v2/ ObjectWrapper. html#TypeWrappe r-concept
https:/