Skip to content
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

rosconsole segfault when ROSCONSOLE_FORMAT uses ${logger} #342

Closed
davetcoleman opened this issue Jan 23, 2014 · 22 comments

Comments

Projects
None yet
4 participants
@davetcoleman
Copy link

commented Jan 23, 2014

None of my ROS packages run anymore (segfault), it worked a few days ago and I didn't change the code. I did play with getting Gazebo 3.0 and drcsim working, and I switched to Groovy for a few minutes for testing Atlas. Now I'm back on Hydro on Precise. I have a local fresh roscore running.

I have a simple program for testing:

#include <ros/ros.h>
int main(int argc, char** argv)
{
  std::cout << "this works" << std::endl;
  ROS_INFO("this segfaults");
  return 0;
}

My CMake is an empty package except this test:

cmake_minimum_required(VERSION 2.8.3)
project(rosconsole_dave_test)

find_package(catkin REQUIRED COMPONENTS
  roscpp
)

catkin_package()

include_directories(
  ${catkin_INCLUDE_DIRS}
)

add_executable(test_ros src/test_ros.cpp)
target_link_libraries(test_ros ${catkin_LIBRARIES})

When I run this binary it crashes on the ROS_INFO part.

GDB Backtrace:

#0  0x00007ffff7733f2b in std::basic_string<char, std::char_traits<char>, std::allocator<char> >::basic_string(std::string const&) () from /usr/lib/x86_64-linux-gnu/libstdc++.so.6
#1  0x00007ffff6eb58ed in ros::console::impl::getName(void*) () from /opt/ros/hydro/lib/librosconsole_log4cxx.so
#2  0x00007ffff7bc759c in ros::console::LoggerToken::getString(void*, ros::console::levels::Level, char const*, char const*, char const*, int) () from /opt/ros/hydro/lib/librosconsole.so
#3  0x00007ffff7bc6594 in ros::console::Formatter::print(void*, ros::console::levels::Level, char const*, char const*, char const*, int) () from /opt/ros/hydro/lib/librosconsole.so
#4  0x00007ffff7bc6a52 in ros::console::_print(void*, ros::console::levels::Level, char const*, char const*, char const*, int) () from /opt/ros/hydro/lib/librosconsole.so
#5  0x00007ffff6eb773f in ros::console::impl::ROSConsoleStdioAppender::append(log4cxx::helpers::ObjectPtrT<log4cxx::spi::LoggingEvent> const&, log4cxx::helpers::Pool&) () from /opt/ros/hydro/lib/librosconsole_log4cxx.so
#6  0x00007ffff699fc00 in log4cxx::AppenderSkeleton::doAppend(log4cxx::helpers::ObjectPtrT<log4cxx::spi::LoggingEvent> const&, log4cxx::helpers::Pool&) () from /usr/lib/liblog4cxx.so.10
#7  0x00007ffff699db54 in log4cxx::helpers::AppenderAttachableImpl::appendLoopOnAppenders(log4cxx::helpers::ObjectPtrT<log4cxx::spi::LoggingEvent> const&, log4cxx::helpers::Pool&) () from /usr/lib/liblog4cxx.so.10
#8  0x00007ffff69e395f in log4cxx::Logger::callAppenders(log4cxx::helpers::ObjectPtrT<log4cxx::spi::LoggingEvent> const&, log4cxx::helpers::Pool&) const () from /usr/lib/liblog4cxx.so.10
#9  0x00007ffff69e3ca7 in log4cxx::Logger::forcedLog(log4cxx::helpers::ObjectPtrT<log4cxx::Level> const&, std::string const&, log4cxx::spi::LocationInfo const&) const () from /usr/lib/liblog4cxx.so.10
#10 0x00007ffff6eb578c in ros::console::impl::print(void*, ros::console::levels::Level, char const*, char const*, char const*, int) () from /opt/ros/hydro/lib/librosconsole_log4cxx.so
#11 0x00007ffff7bc4cd8 in ros::console::print(ros::console::FilterBase*, void*, ros::console::levels::Level, char const*, int, char const*, char const*, ...) () from /opt/ros/hydro/lib/librosconsole.so
#12 0x00000000004014b0 in main ()

Also, I have installed from debian:
liblog4cxx10 0.10.0
liblog4cxx10-dev 0.10.0
ros-hydro-rosconsole 1.9.53

@wjwwood

This comment has been minimized.

Copy link
Member

commented Jan 23, 2014

Can you post the output of dpkg -l | grep ros-hydro?

@wjwwood

This comment has been minimized.

Copy link
Member

commented Jan 23, 2014

After you give us that can you try sudo apt-get dist-upgrade to see if that works around your problem?

@davetcoleman

This comment has been minimized.

Copy link
Author

commented Jan 23, 2014

Packages are already up to date (but ran again anyway).

dpkg -l | grep ros-hydro:
Output: https://gist.github.com/davetcoleman/8588189

@wjwwood

This comment has been minimized.

Copy link
Member

commented Jan 23, 2014

Nothing happens when you do the dist-upgrade?

@davetcoleman

This comment has been minimized.

Copy link
Author

commented Jan 23, 2014

No, I mean I already ran that today.

@dirk-thomas

This comment has been minimized.

Copy link
Member

commented Jan 23, 2014

I just compiled your example and it ran without any problem for me (on Quantal with up-to-date packages).

@wjwwood

This comment has been minimized.

Copy link
Member

commented Jan 23, 2014

Your example and rviz run here on precise, quantal and raring.

Did you do an sudo apt-get update before sudo apt-get dist-upgrade?

@wjwwood

This comment has been minimized.

Copy link
Member

commented Jan 23, 2014

What does your package.xml look like for the example above? (for completeness)

@davetcoleman

This comment has been minimized.

Copy link
Author

commented Jan 23, 2014

My package is the default created by catkin_create_pkg roscpp
https://gist.github.com/davetcoleman/8588395

@davetcoleman

This comment has been minimized.

Copy link
Author

commented Jan 23, 2014

Did you do an sudo apt-get update before sudo apt-get dist-upgrade?

yes

@davetcoleman

This comment has been minimized.

Copy link
Author

commented Jan 23, 2014

I disabled my .bashrc just now and only ran:

source /opt/ros/hydro/setup.bash 
export ROS_MASTER_URI=http://localhost:11311
gdb --ex run --args /home/dave/ros/ws_temp/devel/lib/rosconsole_dave_test/test_ros 

I still have a segfault :-/

@tfoote

This comment has been minimized.

Copy link
Member

commented Jan 23, 2014

I can't reproduce the segfault:

$ gdb --ex run --args ./devel/lib/testpkg/test_ros
GNU gdb (Ubuntu/Linaro 7.4-2012.04-0ubuntu2.1) 7.4-2012.04
Copyright (C) 2012 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
For bug reporting instructions, please see:
<http://bugs.launchpad.net/gdb-linaro/>...
Reading symbols from /tmp/catkin_ws/devel/lib/testpkg/test_ros...(no debugging symbols found)...done.
Starting program: /tmp/catkin_ws/devel/lib/testpkg/test_ros 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
this works
[ INFO] [1390517782.045779355]: this segfaults
[Inferior 1 (process 7037) exited normally]
(gdb) r
Starting program: /tmp/catkin_ws/devel/lib/testpkg/test_ros 
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
this works
[ INFO] [1390517783.460045993]: this segfaults
[Inferior 1 (process 7040) exited normally]
@wjwwood

This comment has been minimized.

Copy link
Member

commented Jan 23, 2014

We're looking at the versions of packages you have listed in your gist, but I'm not sure what else it could be.

Longshots:

  • Are you 32-bit or 64-bit?
  • Are you using a proxy cache (like squid or something)?
  • Are you using a debian mirror?
@wjwwood

This comment has been minimized.

Copy link
Member

commented Jan 23, 2014

Another long shot, does sudo apt-get autoremove help?

@davetcoleman

This comment has been minimized.

Copy link
Author

commented Jan 23, 2014

sudo apt-get autoremove

This removed: libgeos-3.2.2 libgeos-c1 libgeos-dev openjdk-7-jre-lib

But it still doesn't work. Very frustrating...

@davetcoleman

This comment has been minimized.

Copy link
Author

commented Jan 23, 2014

Fixed it, new terminal were sourcing a bad script somewhere...

@wjwwood

This comment has been minimized.

Copy link
Member

commented Jan 23, 2014

Ok, can you close this please?

@davetcoleman

This comment has been minimized.

Copy link
Author

commented Jan 23, 2014

I've found the issue, and its related to the logger level issues ros-drivers/hokuyo_node#8 you guys have been addressing.

As documented on ros.org I set my rosconsole format from my .bashrc file:

export ROSCONSOLE_FORMAT='${severity} ${logger}: ${message}'

After a recent debian update this week, I believe this broke. I get segfaults from all ros nodes using rosconsole. I really like the feature of having better ROS console lines other than time, so I'd like this fixed or a substitute made.

Also, perhaps we should tell ros users? I just spent 2+ hours tracking down this bug.

@dirk-thomas

This comment has been minimized.

Copy link
Member

commented Jan 24, 2014

I updated the issue title to reflect that. With that environment variable I can reproduce and look into the problem. Thanks for narrowing it down.

@ghost ghost assigned dirk-thomas Jan 24, 2014

@dirk-thomas

This comment has been minimized.

Copy link
Member

commented Jan 24, 2014

I created a pull request to fix this bug: #343

@davetcoleman Can you please clone the branch of the pull request into your workspace, recompile and confirm that this fixes the problem for you, too?

@davetcoleman

This comment has been minimized.

Copy link
Author

commented Jan 24, 2014

Will do today

@davetcoleman

This comment has been minimized.

Copy link
Author

commented Jan 24, 2014

I have tested the fix, it works, thanks!
+1

dirk-thomas added a commit that referenced this issue Jan 24, 2014

Merge pull request #343 from ros/rosconsole_log4cxx_logger_name_segfault
fix rosconsole segfault when using ROSCONSOLE_FORMAT with  (fix #342)

rsinnet pushed a commit to MisoRobotics/ros_comm that referenced this issue Jun 19, 2017

Merge pull request ros#343 from ros/rosconsole_log4cxx_logger_name_se…
…gfault

fix rosconsole segfault when using ROSCONSOLE_FORMAT with  (fix ros#342)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.