ros-visualization / rviz

ROS 3D Robot Visualizer
BSD 3-Clause "New" or "Revised" License
847 stars 463 forks source link

rviz segfaults when "add a new display" is clicked #680

Closed liborw closed 11 years ago

liborw commented 11 years ago

Here is an output:

$ rosrun rviz rviz
[ INFO] [1378364823.294536712]: rviz version 1.10.6
[ INFO] [1378364823.294650424]: compiled against OGRE version 1.7.4 (Cthugha)
[ INFO] [1378364823.822973045]: OpenGl version: 4.2 (GLSL 4.2).
[rospack] Warning: no such package media_export
Segmentation fault (core dumped)
dgossow commented 11 years ago

Do you have plugins somewhere that were compiled from source (e.g. the IMU display from visualization_tutorials)? You will need to recompile this due to a change in the RViz headers.

dgossow commented 11 years ago

attn @wjwwood

liborw commented 11 years ago

I have recompiled everything and the problem persist. We have a custom panel, that can be added without problem.

liborw commented 11 years ago

I have tried it without our workspace, as follows without success:

$ source /opt/ros/hydro/setup.bash 
$ rosrun rviz rviz 
[ INFO] [1378368139.662276511]: rviz version 1.10.6
[ INFO] [1378368139.662333507]: compiled against OGRE version 1.7.4 (Cthugha)
[ INFO] [1378368140.157236499]: OpenGl version: 4.2 (GLSL 4.2).
[rospack] Warning: no such package media_export
Segmentation fault (core dumped)
dgossow commented 11 years ago

What's your Ubuntu version, 32/64 bit?

dgossow commented 11 years ago

This was probably caused by #658, I can't reproduce it though.

dgossow commented 11 years ago

Please post the output of rospack plugins --attrib=plugin rviz, so I can check if it's one of the released plugins in hydro that is causing the problem.

liborw commented 11 years ago

It is a 64 bit version of Ubuntu.

Here is the output:

$ rospack plugins --attrib=plugin rviz
moveit_ros_visualization /opt/ros/hydro/share/moveit_ros_visualization/robot_state_rviz_plugin_description.xml
moveit_ros_visualization /opt/ros/hydro/share/moveit_ros_visualization/planning_scene_rviz_plugin_description.xml
moveit_ros_visualization /opt/ros/hydro/share/moveit_ros_visualization/motion_planning_rviz_plugin_description.xml
rviz_plugin_tutorials /opt/ros/hydro/share/rviz_plugin_tutorials/plugin_description.xml
rviz /opt/ros/hydro/share/rviz/plugin_description.xml
dgossow commented 11 years ago

It's the MoveIt plugins that don't support the change in RViz.

@wjwwood @hershwg @liborw @tfoote The changes introduced by #658 result in instantiating all Display types that are available. The MoveIt! plugins are apparently not prepared to deal with this and cause a segfault, which is a critical bug in the Hydro release. I think a change that doesn't just break the ABI but also requires you to change your Display implementation one day before the Hydro release was a bad idea and we should revert #658.

wjwwood commented 11 years ago

We can revert it if you want, but I think the real problem is that the plugins were never written correctly in the first place, this change just exposed the fact that the MoveIt! plugin doesn't do it's resource initialization correctly. What I am saying is that in the long term we should have this new feature and fix up the plugins, so I think we should just do that now instead of reverting the change in rviz.

Reverting this change would break ABI compatibility again, but after the release this time.

I will leave that decision up to you.

wjwwood commented 11 years ago

Just to clarify I agree that merging that so close to the release was a bad idea, and I am currently looking into a patch for the moveit plugin as part of my punishment. I just think fixing the plugin makes more sense at this point.

isucan commented 11 years ago

I think we should fix the moveit plugin. Could you maybe point out the initialization problem for me?

On Thu, Sep 5, 2013 at 10:40 PM, William Woodall notifications@github.comwrote:

Just to clarify I agree that merging that so close to the release was a bad idea, and I am currently looking into a patch for the moveit plugin as part of my punishment. I just think fixing the plugin makes more sense at this point.

— Reply to this email directly or view it on GitHubhttps://github.com/ros-visualization/rviz/issues/680#issuecomment-23895724 .

dgossow commented 11 years ago

683 is related to this.

dgossow commented 11 years ago

I think this is a badly engineered solution. There's no reason why you would need to instantiate a class to get this kind of metainfo, since it's not run time dependent. What speaks against adding this to the plugin description xml file?

wjwwood commented 11 years ago

@isucan I am looking into it now, it looks like the destructor for MotionPlanningDisplay assumes some pointers are initialized which are not, maybe around line 237 in motion_planning_display.cpp.

wjwwood commented 11 years ago

@dgossow I think having to modify all of the existing plugin descriptions would have been the main reason for this.

@bcharrow might be able to shed more light on the situation.

If there are more serious issues with this change, perhaps we should do a revert.

dgossow commented 11 years ago

Look guys, if we keep this that means that we've intruduced an api change that doesn't make sense this way (or maybe someone can convince me therwise) and fragments the plugin metainfo. Getting rid of this will be harder than pushing it back. An advantage of the xml way is that it's perfectly backwards compatible.

wjwwood commented 11 years ago

@dgossow I agree.

I think it doesn't detract from the point that the plugins often assume onInitialized was called before the destructor is called, and that should be fixed.

isucan commented 11 years ago

The assumption is that onInitialize() is always called i the plugin, before the destructor is called. The solution should be to initialize the pointers: text_todisplay; int_markerdisplay; framedock;

to NULL in the constructor.

On Thu, Sep 5, 2013 at 11:10 PM, William Woodall notifications@github.comwrote:

@dgossow https://github.com/dgossow I agree.

I think it doesn't detract from the point that the plugins often assume onInitialized was called before the destructor is called, and that should be fixed.

— Reply to this email directly or view it on GitHubhttps://github.com/ros-visualization/rviz/issues/680#issuecomment-23897792 .

wjwwood commented 11 years ago

It is only text_to_display_ which is not initialized to NULL.

dgossow commented 11 years ago

okay, so I looked into this a bit. Basically, most of the pull request is fine, just the list of Message types should come from the display factory. This means either adding functionality for getting generic metainfo about a class to pluginlib::ClassLoader or parsing the xml file in rviz::DisplayFactory.

dgossow commented 11 years ago

I'm offline for today. Happy discussion.

wjwwood commented 11 years ago

I fixed the moveit plugin:

https://github.com/ros-planning/moveit_ros/pull/301

wjwwood commented 11 years ago

I also fixed the octomap plugin:

https://github.com/OctoMap/octomap_rviz_plugins/pull/9

Now I can run rviz successfully with all of the released packages in Hydro in my ROS_PACKAGE_PATH (with my patches to the plugins of course).

The object_recognition_kitchen plugin is not found, which triggers #680, but with my pull request there it ignores it properly. I filed an issue on the tracker for their plugin also:

https://github.com/wg-perception/object_recognition_ros/issues/7

bcharrow commented 11 years ago

I instantiated plugins to get information about displays because that capability currently isn't in pluginlib. Putting the information into the xml files is preferable to having to instantiate all of the plugins, but I wasn't sure how to extend pluginlib for this feature which would be specific to rviz. Having rviz parse the XML files itself in rviz::DisplayFactory seems like a reasonable middle of the road strategy.

FWIW, @dgossow did suggest that plugins should be deletable even if the onInitialize method isn't called https://github.com/ros-visualization/rviz/pull/658#discussion-diff-5296913

Let me know if there's anything I can do to help fix this.

espee commented 11 years ago

I am still having issues with Octomap pligin as well as oculus ... Could you please suggest any stepwise solution as I am new to ROS as well as unix systm.... the terminal output is :+1:

$ rosrun rviz rviz [ INFO] [1378364823.294536712]: rviz version 1.10.6 [ INFO] [1378364823.294650424]: compiled against OGRE version 1.7.4 (Cthugha) [ INFO] [1378364823.822973045]: OpenGl version: 4.2 (GLSL 4.2). [rospack] Warning: no such package media_export Segmentation fault (core dumped)

saroj@saroj:~$ rosnode list /gazebo /joint_state_publisher /robot_state_publisher /rosout /rviz_1379055084298519157 /rviz_1379055486249748092

saroj@saroj:~$ rospack plugins --attrib=plugin rviz oculus_rviz_plugins /opt/ros/hydro/share/oculus_rviz_plugins/plugin_description.xml octomap_rviz_plugins /opt/ros/hydro/share/octomap_rviz_plugins/plugin_description.xml rviz_plugin_tutorials /opt/ros/hydro/share/rviz_plugin_tutorials/plugin_description.xml rviz /opt/ros/hydro/share/rviz/plugin_description.xml

It seems that Rviz doesnt close properly. So I tried to kill all the processes but without success. However once in a while Rviz does open and I can add displays and so on...(It happens even when I am not using gazebo)..

bcharrow commented 11 years ago

Are your packages up to date? Version 0.0.5 of the octomap plugins which was released a few days ago should fix this issue.

wjwwood commented 11 years ago

@espee You can run this command to get the version of the octomap_rviz_plugins:

$ dpkg -l | grep octomap-rviz-plugins
ii  ros-hydro-octomap-rviz-plugins                   0.0.4-0precise-20130903-2044-+0000                  A set of plugins for displaying occupancy information decoded from binary octomap messages.

You can use a similar command to get the version of oculus_rviz_plugins.

As you can see I still have version 0.0.4 installed, so I would likely have the issues you have. You will likely need to get at least version 0.0.5 of that plugin to resolve this issue. That version has been released for some time now, but it still might not be in the public repositories.


When a new package gets released it is built into a .deb file and placed into a repository called "building". From there it is used to build other packages which depend on it. Periodically the "building" repository is automatically duplicated into what we call the "shadow-fixed" repository. The purpose of this repository is to allow developers a chance to test their deployed changes before we make them available publicly. Then once every week or two we manually sync "shadow-fixed" to the "public" repositories to make them available to end users. You are likely installed from public and that may be why you do not yet have the correct version of that package. You can see the version of each package in each repository here (for hydro):

http://ros.org/debbuild/hydro.html

Just search for octomap_rviz_plugins.


Hopefully the above helps you understand that system. However, looking at the debbuild status page it looks like the new, 0.0.5 version of octomap_rviz_plugins is available in public, so I would recommend updating your packages:

$ sudo apt-get update
$ sudo apt-get dist-upgrade

Note that the above commands will update everything, you can also probably update just the octomap_rviz_plugins package, which will be called ros-hydro-octomap-rviz-plugins.

dgossow commented 11 years ago

686 will restore backwards compatibility.

espee commented 11 years ago

I already have the latest for octomap but could not update to oculus 0.0.8 though. However, I still get the same message as earlier and RViz shuts down immediately though the rosnode still shows its instance.

$ dpkg -l | grep oculus-rviz-plugins ii ros-hydro-oculus-rviz-plugins 0.0.7-0precise-20130909-1449-+0000 RViz plugins for the Oculus Rift. saroj@saroj:~/ros_old_space$ dpkg -l | grep octomap-rviz-plugins ii ros-hydro-octomap-rviz-plugins 0.0.5-1precise-20130909-1448-+0000 A set of plugins for displaying occupancy information decoded from binary octomap messages.

wjwwood commented 11 years ago

Does uninstalling the oculous plugin fix the problem?

espee commented 11 years ago

It doesnt... the message when I use the rospack plugin attribute command is

rviz_plugin_tutorials /opt/ros/hydro/share/rviz_plugin_tutorials/plugin_description.xml rviz /opt/ros/hydro/share/rviz/plugin_description.xml

wjwwood commented 11 years ago

@espee, at one point the rviz_plugin_tutorials's Imu plugin was an issue too, what version of that do you have?

dgossow commented 11 years ago

rviz 1.10.7 should fix all issues related to this api change.

espee commented 11 years ago

I have 0.8.2-0precise version .... I guess the problem is other than this as once out of 5-6 attempts Rviz runs successfully... hope the new version has all these issues fixed..

wjwwood commented 11 years ago

@espee, I think it will, you can give the new one a try like this:

$ source /opt/ros/hydro/setup.bash
$ mkdir /tmp/rviz_ws
$ cd /tmp/rviz_ws
$ sudo apt-get install python-rosinstall-generator
$ rosinstall_generator --tar rviz > rviz.rosinstall

Verify the rviz.rosinstall file looks like this:

- tar:
    local-name: rviz
    uri: https://github.com/ros-gbp/rviz-release/archive/release/hydro/rviz/1.10.7-0.tar.gz
    version: rviz-release-release-hydro-rviz-1.10.7-0

Then:

$ wstool init src rviz.rosinstall
$ catkin_make
$ source ./devel/setup.bash
$ rosrun rviz rviz

You don't have to try it out, but if you have time to test out the new version that would be helpful.

ashleylid commented 10 years ago

Hi.. nope.. I did all of this and didnt work.. I am getting this every time I try and run rviz:

robot@robot-ln1:~/catkin_ws$ rosrun rviz rviz [ INFO] [1405553174.019589626]: rviz version 1.10.16 [ INFO] [1405553174.019650730]: compiled against OGRE version 1.7.4 (Cthugha) Segmentation fault (core dumped)

has this been solved?

I do have moveit installed.. I have just installed vrep_ros_bridge.. Ubuntu 12.04 x64, Hydro

wjwwood commented 10 years ago

The segfault in this issue has been resolved. Your segfault is probably something else. You will have to provide a back trace in a new issue for us to help you.

ashleylid commented 10 years ago

ok.. how do I do that? what do you mean by a back trace?

wjwwood commented 10 years ago

You'll have to use lldb or gdb:

http://ftp.gnu.org/old-gnu/Manuals/gdb-5.1.1/html_node/gdb_42.html

ashleylid commented 10 years ago

ok.. all I am doing is running roscore and then rosrun rviz rviz ..

ashleylid commented 10 years ago

right - I did an update and Ubuntu suggested a new kernel support option - which I selected.. computer restarted and voila - it is now working..

wjwwood commented 10 years ago

Interesting, it may have been updates to the ROS packages or a change in your video card settings possibly.

If you get it again use gdb to capture the segfault back trace:

$ gdb /opt/ros/<rosdistro>/lib/rviz/rviz

Obviously replacing <rosdistro> with either groovy, hydro, or indigo.

ashleylid commented 10 years ago

will do..

On Thu, Jul 17, 2014 at 1:52 AM, William Woodall notifications@github.com wrote:

Interesting, it may have been updates to the ROS packages or a change in your video card settings possibly.

If you get it again use gdb to capture the segfault back trace:

$ gdb /opt/ros//lib/rviz/rviz

Obviously replacing with either groovy, hydro, or indigo.

— Reply to this email directly or view it on GitHub https://github.com/ros-visualization/rviz/issues/680#issuecomment-49243153 .