Comment 3 for bug 1767601

Revision history for this message
Jérôme Duriez (jduriez) wrote :

Thanks, I could reproduce the crash with this script.

Solution
********

The change [1] should fix your problems. Obviously you need to update your yade version to enjoy this change.

In terms of package versions, I do not know when this change will be reflected in yadedaily, considering in particular we currently have compiling problems. [2]

If you use a local source code version, the best is for you to apply locally the same change as [1] (and to recompile.. :-) )

Reason
******

As told by Jan in the Launchpad question thread, the bug came from growParticles() where interactions operations were performed before checking whether the interaction actually is real. Because these soon-to-be-erased interactions (involving deleted bodies) were accessed, deleted bodies, were tried to be accessed as well, leading to the crash.

Advice
******

The MWE below was enough to trigger the exact same bug:
-------------
O.bodies.append(sphere(Vector3(0,0,0),1))
O.bodies.append(sphere(Vector3(0,0,2),1))
O.step()
O.bodies.erase(1)
growParticles(1.5)
-------------
and would have maybe (??) led to a faster bug resolution, enticing more people to look faster at the issue.

I understand showing real MWE may require some YADE practice.. Nevertheless, it's worth trying it, and here you had some elements from Jan narrowing down the problem to Shop::growParticles()

This being said, I just hope this will motivate you to dig into the source code, happy YADE-ing ! ;-)

[1] https://github.com/yade/trunk/commit/bd1089e77eae83c41c4ce0c60873e1e234ba9c89
[2] https://yade-dem.org/buildbot/one_line_per_build