clearpathrobotics / LMS1xx

Driver for SICK LMS1xx. Based on https://github.com/RCPRG-ros-pkg/RCPRG_laser_drivers
56 stars 101 forks source link

[Closed] Error due to faulty ROS installation #10

Closed lorenwel closed 9 years ago

lorenwel commented 9 years ago

We are currently working with an LMS151 running the newest firmware 1.60. We were running both an LMS111 and an LMS151 with earlier firmware versions before and with none of the devices the following error occurred. Initially, I had the problem that the lms1xx node would connect to the laser but fail to read/write from it because the new firmware has the binary communication for the Ethernet AUX-port enabled and SOPAS does not allow this to be changed. However, after switching TCP ports of the Ethernet AUX-Port and the Ethernet Host-port, which works in ASCII mode, the node now initializes successfully and displays the following behavior. The node crashes whenever another node subscribes to the /scan topic. However, one correct message is published before the crash occurs. When I subscribe to the topic before I launch the node, it crashes while publishing the scan message (line 126), with the error message

*** Error in '/home/lorenz/catkin_ws/devel/lib/lms1xx/LMS1xx_node': malloc(): memory corruption: 0x0000000001494de0 ***

If I let the node run for a few seconds and then subscribe, it crashes while getting new data (line 114), with the error message

*** Error in '/home/lorenz/catkin_ws/devel/lib/lms1xx/LMS1xx_node': free(): invalid next size (normal): 0x0000000001118f90 ***
======= Backtrace: =========
/lib/x86_64-linux-gnu/libc.so.6(+0x80a46)[0x7fb5045e5a46]
/home/lorenz/catkin_ws/devel/lib/lms1xx/LMS1xx_node(_ZN5boost20checked_array_deleteIhEEvPT_+0x1f)[0x40fba6]
/home/lorenz/catkin_ws/devel/lib/lms1xx/LMS1xx_node(_ZNK5boost21checked_array_deleterIhEclEPh+0x1c)[0x40f23a]
/home/lorenz/catkin_ws/devel/lib/lms1xx/LMS1xx_node(_ZN5boost6detail18sp_counted_impl_pdIPhNS_21checked_array_deleterIhEEE7disposeEv+0x27)[0x41190d]
/opt/ros/hydro/lib/libroscpp.so(_ZN5boost12shared_arrayIhEaSERKS1_+0x4e)[0x7fb50577adfe]
/opt/ros/hydro/lib/libroscpp.so(_ZN3ros10Connection14writeTransportEv+0x2d3)[0x7fb50577e9e3]
/opt/ros/hydro/lib/libroscpp.so(_ZN3ros10Connection11onWriteableERKN5boost10shared_ptrINS_9TransportEEE+0x45)[0x7fb50577f1a5]
/opt/ros/hydro/lib/libroscpp.so(_ZNK5boost9function1IvRKNS_10shared_ptrIN3ros9TransportEEEEclES6_+0x18)[0x7fb5057d66a8]
/opt/ros/hydro/lib/libroscpp.so(_ZN3ros12TransportTCP12socketUpdateEi+0xa3)[0x7fb5057d5bb3]
/opt/ros/hydro/lib/libroscpp.so(_ZN3ros7PollSet6updateEi+0x404)[0x7fb505804b44]
/opt/ros/hydro/lib/libroscpp.so(_ZN3ros11PollManager10threadFuncEv+0x48)[0x7fb5057ad348]
/usr/lib/libboost_thread.so.1.49.0(+0xe6e9)[0x7fb503f496e9]
/lib/x86_64-linux-gnu/libpthread.so.0(+0x7f8e)[0x7fb504e4ef8e]
/lib/x86_64-linux-gnu/libc.so.6(clone+0x6d)[0x7fb50465fa0d]
======= Memory map: ========
00400000-00416000 r-xp 00000000 08:06 415964                             /home/lorenz/catkin_ws/devel/lib/lms1xx/LMS1xx_node
00616000-00617000 r--p 00016000 08:06 415964                             /home/lorenz/catkin_ws/devel/lib/lms1xx/LMS1xx_node
00617000-00618000 rw-p 00017000 08:06 415964                             /home/lorenz/catkin_ws/devel/lib/lms1xx/LMS1xx_node
01102000-01123000 rw-p 00000000 00:00 0                                  [heap]
7fb4e8000000-7fb4e8021000 rw-p 00000000 00:00 0 
7fb4e8021000-7fb4ec000000 ---p 00000000 00:00 0 
7fb4f0000000-7fb4f0021000 rw-p 00000000 00:00 0 
7fb4f0021000-7fb4f4000000 ---p 00000000 00:00 0 
7fb4f4000000-7fb4f4021000 rw-p 00000000 00:00 0 
7fb4f4021000-7fb4f8000000 ---p 00000000 00:00 0 
7fb4f8000000-7fb4f8021000 rw-p 00000000 00:00 0 
7fb4f8021000-7fb4fc000000 ---p 00000000 00:00 0 
7fb4fd61c000-7fb4fd61d000 ---p 00000000 00:00 0 
7fb4fd61d000-7fb4fde1d000 rw-p 00000000 00:00 0                          [stack:6139]
7fb4fde1d000-7fb4fde1e000 ---p 00000000 00:00 0 
7fb4fde1e000-7fb4fe61e000 rw-p 00000000 00:00 0                          [stack:6134]
7fb4fe61e000-7fb4fe61f000 ---p 00000000 00:00 0 
7fb4fe61f000-7fb4fee1f000 rw-p 00000000 00:00 0                          [stack:6133]
7fb4fee1f000-7fb4fee20000 ---p 00000000 00:00 0 
7fb4fee20000-7fb4ff620000 rw-p 00000000 00:00 0                          [stack:6132]
7fb4ff620000-7fb4ff62c000 r-xp 00000000 08:06 1072771                    /lib/x86_64-linux-gnu/libnss_files-2.17.so
7fb4ff62c000-7fb4ff82b000 ---p 0000c000 08:06 1072771                    /lib/x86_64-linux-gnu/libnss_files-2.17.so
7fb4ff82b000-7fb4ff82c000 r--p 0000b000 08:06 1072771                    /lib/x86_64-linux-gnu/libnss_files-2.17.so
7fb4ff82c000-7fb4ff82d000 rw-p 0000c000 08:06 1072771                    /lib/x86_64-linux-gnu/libnss_files-2.17.so
7fb4ff82d000-7fb4fff4e000 r--p 00000000 08:06 268835                     /usr/lib/locale/locale-archive
7fb4fff4e000-7fb5010bd000 r-xp 00000000 08:06 275998                     /usr/lib/x86_64-linux-gnu/libicudata.so.48.1.1
7fb5010bd000-7fb5012bc000 ---p 0116f000 08:06 275998                     /usr/lib/x86_64-linux-gnu/libicudata.so.48.1.1
7fb5012bc000-7fb5012bd000 r--p 0116e000 08:06 275998                     /usr/lib/x86_64-linux-gnu/libicudata.so.48.1.1
7fb5012bd000-7fb5012be000 rw-p 0116f000 08:06 275998                     /usr/lib/x86_64-linux-gnu/libicudata.so.48.1.1
7fb5012be000-7fb5012c1000 r-xp 00000000 08:06 1072770                    /lib/x86_64-linux-gnu/libdl-2.17.so
7fb5012c1000-7fb5014c0000 ---p 00003000 08:06 1072770                    /lib/x86_64-linux-gnu/libdl-2.17.so
7fb5014c0000-7fb5014c1000 r--p 00002000 08:06 1072770                    /lib/x86_64-linux-gnu/libdl-2.17.so
7fb5014c1000-7fb5014c2000 rw-p 00003000 08:06 1072770                    /lib/x86_64-linux-gnu/libdl-2.17.so
7fb5014c2000-7fb5014c6000 r-xp 00000000 08:06 1050698                    /lib/x86_64-linux-gnu/libuuid.so.1.3.0
7fb5014c6000-7fb5016c5000 ---p 00004000 08:06 1050698                    /lib/x86_64-linux-gnu/libuuid.so.1.3.0
7fb5016c5000-7fb5016c6000 r--p 00003000 08:06 1050698                    /lib/x86_64-linux-gnu/libuuid.so.1.3.0
7fb5016c6000-7fb5016c7000 rw-p 00004000 08:06 1050698                    /lib/x86_64-linux-gnu/libuuid.so.1.3.0
7fb5016c7000-7fb5016ed000 r-xp 00000000 08:06 1050570                    /lib/x86_64-linux-gnu/libexpat.so.1.6.0
7fb5016ed000-7fb5018ed000 ---p 00026000 08:06 1050570                    /lib/x86_64-linux-gnu/libexpat.so.1.6.0
7fb5018ed000-7fb5018ef000 r--p 00026000 08:06 1050570                    /lib/x86_64-linux-gnu/libexpat.so.1.6.0
7fb5018ef000-7fb5018f0000 rw-p 00028000 08:06 1050570                    /lib/x86_64-linux-gnu/libexpat.so.1.6.0
7fb5018f0000-7fb5018fa000 r-xp 00000000 08:06 1072775                    /lib/x86_64-linux-gnu/libcrypt-2.17.so
7fb5018fa000-7fb501af9000 ---p 0000a000 08:06 1072775                    /lib/x86_64-linux-gnu/libcrypt-2.17.so
7fb501af9000-7fb501afa000 r--p 00009000 08:06 1072775                    /lib/x86_64-linux-gnu/libcrypt-2.17.so
7fb501afa000-7fb501afb000 rw-p 0000a000 08:06 1072775                    /lib/x86_64-linux-gnu/libcrypt-2.17.so
7fb501afb000-7fb501b29000 rw-p 00000000 00:00 0 
7fb501b29000-7fb501ce2000 r-xp 00000000 08:06 276000                     /usr/lib/x86_64-linux-gnu/libicui18n.so.48.1.1
7fb501ce2000-7fb501ee1000 ---p 001b9000 08:06 276000                     /usr/lib/x86_64-linux-gnu/libicui18n.so.48.1.1
7fb501ee1000-7fb501eee000 r--p 001b8000 08:06 276000                     /usr/lib/x86_64-linux-gnu/libicui18n.so.48.1.1
7fb501eee000-7fb501eef000 rw-p 001c5000 08:06 276000                     /usr/lib/x86_64-linux-gnu/libicui18n.so.48.1.1
7fb501eef000-7fb502045000 r-xp 00000000 08:06 276001                     /usr/lib/x86_64-linux-gnu/libicuuc.so.48.1.1
7fb502045000-7fb502244000 ---p 00156000 08:06 276001                     /usr/lib/x86_64-linux-gnu/libicuuc.so.48.1.1
7fb502244000-7fb502255000 r--p 00155000 08:06 276001                     /usr/lib/x86_64-linux-gnu/libicuuc.so.48.1.1
7fb502255000-7fb502256000 rw-p 00166000 08:06 276001                     /usr/lib/x86_64-linux-gnu/libicuuc.so.48.1.1
7fb502256000-7fb50225a000 rw-p 00000000 00:00 0 
7fb50225a000-7fb502291000 r-xp 00000000 08:06 281434                     /usr/lib/libapr-1.so.0.4.6
7fb502291000-7fb502490000 ---p 00037000 08:06 281434                     /usr/lib/libapr-1.so.0.4.6
7fb502490000-7fb502491000 r--p 00036000 08:06 281434                     /usr/lib/libapr-1.so.0.4.6
7fb502491000-7fb502492000 rw-p 00037000 08:06 281434                     /usr/lib/libapr-1.so.0.4.6Aborted (core dumped)

I'm running Hydro on Ubuntu 13.04.

ssrselvamraju commented 9 years ago

@lorenwel How did you solve this issue? Were you compiling from source, or did you apt-get install?

ssrselvamraju commented 9 years ago

There seem to be memory leak issues. Running the LMS node with Valgrind gives the following output.

minx@minx: /home/devel/lib/lms1xx$ valgrind --leak-check=full ./LMS1xx_node
==19639== Memcheck, a memory error detector
==19639== Copyright (C) 2002-2013, and GNU GPL'd, by Julian Seward et al.
==19639== Using Valgrind-3.10.0.SVN and LibVEX; rerun with -h for copyright info
==19639== Command: ./LMS1xx_node
==19639== 
[ INFO] [1436312040.946052249]: Connecting to laser at : 192.168.1.22
==19639== Conditional jump or move depends on uninitialised value(s)
==19639==    at 0x4C31A06: rawmemchr (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==19639==    by 0x5F7C0C1: _IO_str_init_static_internal (strops.c:44)
==19639==    by 0x5F6FA66: vsscanf (iovsscanf.c:43)
==19639==    by 0x5F5C286: sscanf (sscanf.c:32)
==19639==    by 0x4E38DB6: LMS1xx::getScanOutputRange() const (in /home/min8/k5_adm_3/devel/lib/libLMS1xx.so)
==19639==    by 0x40B7B7: main (in /home/min8/k5_adm_3/devel/lib/lms1xx/LMS1xx_node)
==19639== 
[ INFO] [1436312041.203160912]: Connected to laser.
==19639== Conditional jump or move depends on uninitialised value(s)
==19639==    at 0x4E38B86: LMS1xx::setScanDataCfg(_scanDataCfg const&) (in /home/min8/k5_adm_3/devel/lib/libLMS1xx.so)
==19639==    by 0x40C395: main (in /home/min8/k5_adm_3/devel/lib/lms1xx/LMS1xx_node)
==19639== 
==19639== Invalid write of size 4
==19639==    at 0x40C4BB: main (in /home/min8/k5_adm_3/devel/lib/lms1xx/LMS1xx_node)
==19639==  Address 0xae68584 is 0 bytes after a block of size 1,444 alloc'd
==19639==    at 0x4C2B0E0: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==19639==    by 0x410311: __gnu_cxx::new_allocator<float>::allocate(unsigned long, void const*) (in /home/min8/k5_adm_3/devel/lib/lms1xx/LMS1xx_node)
==19639==    by 0x40FDB8: std::_Vector_base<float, std::allocator<float> >::_M_allocate(unsigned long) (in /home/min8/k5_adm_3/devel/lib/lms1xx/LMS1xx_node)
==19639==    by 0x40F4C6: std::vector<float, std::allocator<float> >::_M_fill_insert(__gnu_cxx::__normal_iterator<float*, std::vector<float, std::allocator<float> > >, unsigned long, float const&) (in /home/min8/k5_adm_3/devel/lib/lms1xx/LMS1xx_node)
==19639==    by 0x40ECB5: std::vector<float, std::allocator<float> >::insert(__gnu_cxx::__normal_iterator<float*, std::vector<float, std::allocator<float> > >, unsigned long, float const&) (in /home/min8/k5_adm_3/devel/lib/lms1xx/LMS1xx_node)
==19639==    by 0x40DA87: std::vector<float, std::allocator<float> >::resize(unsigned long, float) (in /home/min8/k5_adm_3/devel/lib/lms1xx/LMS1xx_node)
==19639==    by 0x40C31E: main (in /home/min8/k5_adm_3/devel/lib/lms1xx/LMS1xx_node)
==19639== 
==19639== Invalid write of size 4
==19639==    at 0x40C51D: main (in /home/min8/k5_adm_3/devel/lib/lms1xx/LMS1xx_node)
==19639==  Address 0xae68b74 is 0 bytes after a block of size 1,444 alloc'd
==19639==    at 0x4C2B0E0: operator new(unsigned long) (in /usr/lib/valgrind/vgpreload_memcheck-amd64-linux.so)
==19639==    by 0x410311: __gnu_cxx::new_allocator<float>::allocate(unsigned long, void const*) (in /home/min8/k5_adm_3/devel/lib/lms1xx/LMS1xx_node)
==19639==    by 0x40FDB8: std::_Vector_base<float, std::allocator<float> >::_M_allocate(unsigned long) (in /home/min8/k5_adm_3/devel/lib/lms1xx/LMS1xx_node)
==19639==    by 0x40F4C6: std::vector<float, std::allocator<float> >::_M_fill_insert(__gnu_cxx::__normal_iterator<float*, std::vector<float, std::allocator<float> > >, unsigned long, float const&) (in /home/min8/k5_adm_3/devel/lib/lms1xx/LMS1xx_node)
==19639==    by 0x40ECB5: std::vector<float, std::allocator<float> >::insert(__gnu_cxx::__normal_iterator<float*, std::vector<float, std::allocator<float> > >, unsigned long, float const&) (in /home/min8/k5_adm_3/devel/lib/lms1xx/LMS1xx_node)
==19639==    by 0x40DA87: std::vector<float, std::allocator<float> >::resize(unsigned long, float) (in /home/min8/k5_adm_3/devel/lib/lms1xx/LMS1xx_node)
==19639==    by 0x40C33F: main (in /home/min8/k5_adm_3/devel/lib/lms1xx/LMS1xx_node)
ssrselvamraju commented 9 years ago

@mikepurvis Any suggestions on this issue please?

SICK-NorthAmerica commented 9 years ago

The update on 5/17 in which @lorenwel changed the title from "Crash when subscribing to /scan topic" to "[Closed] Error due to faulty ROS installation" indicates to me that a flaw was found in the ROS installation and the issue was resolved by reinstalling the ROS package.

Are you having an issue identical to @lorenwel's original problem description?

ssrselvamraju commented 9 years ago

@SICK-NorthAmerica Yes! And a reinstallaton of the ROS package doesn't seem to help. When I run the LMS driver with the memory leak analysis tool (valgrind) - it seems to work fine, but throws Segmentation faults and issues similar to what @lorenwel's posted here, when run with rosrun, or directly running the compiled file.

P.S. I tried both downloading a release from source and compiling it - also installing the lidar driver with apt-get.

ssrselvamraju commented 9 years ago

OK - so fixed the issue by changing the scan resolution on the Lidar. The driver seems to work only with a scan resolution of 0.5, while I had my Lidar set to 0.25. Changing my Lidar back to 0.5 fixed the issue.