Comment 17 for bug 803774

Revision history for this message
Chiara Modenese (chiara-modenese) wrote : Re: [Yade-dev] [Bug 803774] Re: Saving, loading simulation with erased bodies crash.

On 16 Jul 2012, at 02:00, Chareyre wrote:

> This fix is correct I think.
> If I guess correctly (I didn't check the code), the problem is that calling
> erase(i) on an interaction is not erasing immediatly. Instead it sends a
> message to the collider to erase "i" at next step. If you save, the next
> step never comes and junk interactions are saved.
Good point.

>
> An alternative fix would be to check bodies before saving (if b1 or b2 does
> not exist, don't save). I'm not sure it would be better, but it would be
> more complicated probably.
The problem is with contacts (and ultimately with bodies) so I think it is easier to fix it as I did. I think a better solution would be to modify erase() but I do not have further time to investigate/test. If you agree for the moment, Anton can you commit the fix please?

Chiara

>
> --
> You received this bug notification because you are a member of Yade
> developers, which is the registrant for Yade.
> https://bugs.launchpad.net/bugs/803774
>
> Title:
> Saving, loading simulation with erased bodies crash.
>
> Status in Yet Another Dynamic Engine:
> Fix Released
>
> Bug description:
> Here is the bug :
>
> - launch yade (for example without any script)
> - add a sphere : O.bodies.append(utils.sphere((0.2,0.2,0.2),0.006))
> - delete it : O.bodies.erase(0)
> - save yade's universe : O.save("./test")
> - quit yade
> - launch yade
> - load the file : O.load("./test")
> ->segmentation fault
>
> I think it's because when you erase something the size of O.bodies (etc...) doesn't change and now contains an empty value. (the c++ array may not be dynamic ?)
> So when the O.load() function is called, yade try to load a non-existant body ?
>
> Maybe this can be fixed by changing the load() method ?
>
> I joined the debug output.
>
> To manage notifications about this bug go to:
> https://bugs.launchpad.net/yade/+bug/803774/+subscriptions
>
> _______________________________________________
> Mailing list: https://launchpad.net/~yade-dev
> Post to : <email address hidden>
> Unsubscribe : https://launchpad.net/~yade-dev
> More help : https://help.launchpad.net/ListHelp