Skip to content

Conversation

@jmirabel
Copy link
Contributor

@jmirabel jmirabel commented Apr 11, 2019

Related to #35

I don't know exactly why this works (and whether this works for everyone).

@nim65s
Copy link
Contributor

nim65s commented Apr 11, 2019

I can confirm that this fix SEGV on Arch (boost 1.69, python3.7 & numpy 1.16.2)

@nim65s
Copy link
Contributor

nim65s commented Apr 11, 2019

It also works on 18.04. On both Arch & 18.04, the switch test is not passing, but this is another issue for which I can provide a fix.

@nim65s
Copy link
Contributor

nim65s commented Apr 11, 2019

https://gepgitlab.laas.fr/gsaurel/eigenpy/pipelines/4046 LGTM !

It would be really nice if we could make a release with this, so that I can ship it with pinocchio v2.1.2 & HPP 4.5 on my next robotpkg PR

@jmirabel
Copy link
Contributor Author

I ended up with this fix because the SEGV arises when deleting the numpy module object. I guess it is deleted twice.

Increasing the reference count may have the side effect of Numpy module not being deleted. I didn't check that. It shouldn't be hard with a break point in gdb.

Copy link
Contributor

@jcarpent jcarpent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jmirabel Thanks for this nice fix.


NumpyMatrixObject = pyModule.attr("matrix");
NumpyMatrixType = reinterpret_cast<PyTypeObject*>(NumpyMatrixObject.ptr());
NumpyAsMatrixObject = pyModule.attr("asmatrix");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why have you deleted that? Is it deprecated on newer versions of NumPy?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It isn't used so I thought it was here as a result of development code not being cleaned up.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to keep as they are not related to the current bug.

@jcarpent
Copy link
Contributor

jcarpent commented Apr 12, 2019

@jmirabel Indeed it may happen that some data are kept in memory with this increase of reference. Maybe, we should check the Python version and not apply it to Python 2 & 3.

@jmirabel
Copy link
Contributor Author

jmirabel commented Apr 12, 2019

I am not gonna do a specific case for Python 2. I would rather say: for Python 2, use eigenpy <= 1.5.

We can open an issue in case someone is able to spend time on the possibly not deleted object.

@jcarpent
Copy link
Contributor

I don’t agree as part of the current users are still using Python 2. We cannot deprecate now this feature even if Python will be over soon.


NumpyMatrixObject = pyModule.attr("matrix");
NumpyMatrixType = reinterpret_cast<PyTypeObject*>(NumpyMatrixObject.ptr());
NumpyAsMatrixObject = pyModule.attr("asmatrix");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer to keep as they are not related to the current bug.

Copy link
Contributor

@jcarpent jcarpent left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot for this additional fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants