-
Notifications
You must be signed in to change notification settings - Fork 74k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using tensorflow.contrib with cv_bridge causes tcmalloc error #8146
Comments
@jhseu Could you please comment on whether recent jemalloc/tcmalloc changes might affect this? |
It's unrelated to jemalloc. My guess is it's an issue with your usage of tcmalloc. That error would happen if you call tcmalloc's malloc() and try to free with glibc malloc() and vice-versa. Disable tcmalloc? |
@jhseu , I'm not exactly sure how to disable tcmalloc. I assume it's getting called either from tensorflow or cv_bridge, so would the best way be to find the actual |
It's definitely not in TensorFlow. We don't use tcmalloc anywhere. So it's either coming from your environment or being used by cv_bridge. You can track it down through |
This was the output:
I wasn't really able to make sense of it. I also searched through all of In a debugger, I stepped through the program until it threw the error. The offending line was
Is it possible that cv_bridge is using a version of OpenCV that is not compatible with the recent Tensorflow update?
|
We don't depend on opencv in TensorFlow, so I'm not sure. Closing out, though, because this bug is unlikely to be an issue in TensorFlow. |
That may be, but the script does not throw the error without the |
It's still unlikely to be in TensorFlow. My best guess without trying it out is that there's a shared module dependency somewhere, TF is using glibc malloc upon module import, and somewhere along the long someone is using tcmalloc and freeing. Libraries shouldn't be switching out malloc implementations unless its usage is completely self-contained. |
I (sort of) fixed it: import cv_bridge # <-- note: switched with
import tensorflow.contrib # this
import rospy
rospy.init_node('node') This does not throw an error. Why the order of imports matters is beyond me. These kinds of things seem to crop up often when working with ros. |
Yeah, import order affects symbol resolution order. My explanation before is most likely right, and it's a bug in cv_bridge. |
@lobachevzky Thanks for following up with the workaround. It does indeed look like cv_bridge is doing something bad with tc_malloc. |
Ok. I did a little more digging and I found this line in my export LD_PRELOAD="/usr/lib/libtcmalloc_minimal.so.4" Commenting this out solved the problem. I'm not really sure which of the three libraries that were involved would be responsible, but it might be good to include a more informative error message. |
NOTE: Only file GitHub issues for bugs and feature requests. All other topics will be closed.
For general support from the community, see StackOverflow.
To make bugs and feature requests more easy to find and organize, we close issues that are deemed
out of scope for GitHub Issues and point people to StackOverflow.
For bugs or installation issues, please provide the following information.
The more information you provide, the more easily we will be able to offer
help and advice.
What related GitHub issues or StackOverflow threads have you found by searching the web for your problem?
None.
Environment info
Operating System:
Installed version of CUDA and cuDNN:
(please attach the output of
ls -l /path/to/cuda/lib/libcud*
):If installed from binary pip package, provide:
python -c "import tensorflow; print(tensorflow.__version__)"
.If installed from source, provide
git rev-parse HEAD
)bazel version
If possible, provide a minimal reproducible example (We usually don't have time to read hundreds of lines of your code)
This throws the following error:
I'll also post to stackoverflow and to the cv_bridge page (ros-perception/vision_opencv#161).
What other attempted solutions have you tried?
I tried reinstalling ros and tensorflow. No change. I also tried
print(cv_bridge.__file__)
to make sure I was importing the right directory forcv_bridge
.Logs or other output that would be helpful
(If logs are large, please upload as attachment or provide link).
The text was updated successfully, but these errors were encountered: