DEV Community

Discussion on: I'm an Expert in Memory Management & Segfaults, Ask Me Anything!

rishabh900 profile image
all_yours

The code I posted earlier is the context for frame 1&2. Actually this is the gdb output which I posted.

Well I just ran the same in valgrind and it gave:-

deadmanlogan@war:~$ roslaunch pr2_description pr2.launch
... logging to /home/deadmanlogan/.ros/log/12f716ec-e077-11e9-af75-68071520849c/roslaunch-war-13334.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.

xacro: Traditional processing is deprecated. Switch to --inorder processing!
To check for compatibility of your document, use option --check-order.
For more infos, see http://wiki.ros.org/xacro#Processing_Order
xacro.py is deprecated; please use xacro instead
started roslaunch server http://war:36573/

SUMMARY
========

PARAMETERS
 * /robo_state_publisher/publish_frequency: 30.0
 * /robot_description: <?xml version="1....
 * /rosdistro: kinetic
 * /rosversion: 1.12.14
 * /use_sim_time: True

NODES
  /
    gazebo (gazebo_ros/gzserver)
    robo_state_publisher (robot_state_publisher/robot_state_publisher)
    urdf_spawner (gazebo_ros/spawn_model)

auto-starting new master
process[master]: started with pid [13348]
ROS_MASTER_URI=http://localhost:11311

setting /run_id to 12f716ec-e077-11e9-af75-68071520849c
process[rosout-1]: started with pid [13361]
started core service [/rosout]
process[gazebo-2]: started with pid [13384]
process[urdf_spawner-3]: started with pid [13386]
process[robo_state_publisher-4]: started with pid [13387]
==13384== Memcheck, a memory error detector
==13384== Copyright (C) 2002-2015, and GNU GPL'd, by Julian Seward et al.
==13384== Using Valgrind-3.11.0 and LibVEX; rerun with -h for copyright info
==13384== Command: /home/deadmanlogan/i_am_from_source/ros_catkin_ws/src/gazebo_ros_pkgs/gazebo_ros/scripts/gzserver -e ode worlds/empty.world __name:=gazebo __log:=/home/deadmanlogan/.ros/log/12f716ec-e077-11e9-af75-68071520849c/gazebo-2.log
==13384== 
SpawnModel script started
[INFO] [1569513769.345868, 0.000000]: Loading model XML from ros parameter
[INFO] [1569513769.363155, 0.000000]: Waiting for service /gazebo/spawn_urdf_model
==13447== Warning: invalid file descriptor -1 in syscall close()
==13448== 
==13448== HEAP SUMMARY:
==13448==     in use at exit: 23,063 bytes in 127 blocks
==13448==   total heap usage: 220 allocs, 93 frees, 96,415 bytes allocated
==13448== 
==13448== LEAK SUMMARY:
==13448==    definitely lost: 0 bytes in 0 blocks
==13448==    indirectly lost: 0 bytes in 0 blocks
==13448==      possibly lost: 0 bytes in 0 blocks
==13448==    still reachable: 23,063 bytes in 127 blocks
==13448==         suppressed: 0 bytes in 0 blocks
==13448== Rerun with --leak-check=full to see details of leaked memory
==13448== 
==13448== For counts of detected and suppressed errors, rerun with: -v
==13448== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
==13447== 
==13447== HEAP SUMMARY:
==13447==     in use at exit: 14,899 bytes in 127 blocks
==13447==   total heap usage: 219 allocs, 92 frees, 88,235 bytes allocated
==13447== 
==13447== LEAK SUMMARY:
==13447==    definitely lost: 0 bytes in 0 blocks
==13447==    indirectly lost: 0 bytes in 0 blocks
==13447==      possibly lost: 0 bytes in 0 blocks
==13447==    still reachable: 14,899 bytes in 127 blocks
==13447==         suppressed: 0 bytes in 0 blocks
==13447== Rerun with --leak-check=full to see details of leaked memory
==13447== 
==13447== For counts of detected and suppressed errors, rerun with: -v
==13447== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
==13450== Warning: invalid file descriptor -1 in syscall close()
==13451== 
==13451== HEAP SUMMARY:
==13451==     in use at exit: 23,112 bytes in 129 blocks
==13451==   total heap usage: 226 allocs, 97 frees, 96,533 bytes allocated
==13451== 
==13451== LEAK SUMMARY:
==13451==    definitely lost: 0 bytes in 0 blocks
==13451==    indirectly lost: 0 bytes in 0 blocks
==13451==      possibly lost: 0 bytes in 0 blocks
==13451==    still reachable: 23,112 bytes in 129 blocks
==13451==         suppressed: 0 bytes in 0 blocks
==13451== Rerun with --leak-check=full to see details of leaked memory
==13451== 
==13451== For counts of detected and suppressed errors, rerun with: -v
==13451== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
==13450== 
==13450== HEAP SUMMARY:
==13450==     in use at exit: 14,948 bytes in 129 blocks
==13450==   total heap usage: 225 allocs, 96 frees, 88,353 bytes allocated
==13450== 
==13450== LEAK SUMMARY:
==13450==    definitely lost: 0 bytes in 0 blocks
==13450==    indirectly lost: 0 bytes in 0 blocks
==13450==      possibly lost: 0 bytes in 0 blocks
==13450==    still reachable: 14,948 bytes in 129 blocks
==13450==         suppressed: 0 bytes in 0 blocks
==13450== Rerun with --leak-check=full to see details of leaked memory
==13450== 
==13450== For counts of detected and suppressed errors, rerun with: -v
==13450== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
==13453== Warning: invalid file descriptor -1 in syscall close()
==13454== 
==13454== HEAP SUMMARY:
==13454==     in use at exit: 23,131 bytes in 129 blocks
==13454==   total heap usage: 231 allocs, 102 frees, 96,638 bytes allocated
==13454== 
==13454== LEAK SUMMARY:
==13454==    definitely lost: 0 bytes in 0 blocks
==13454==    indirectly lost: 0 bytes in 0 blocks
==13454==      possibly lost: 0 bytes in 0 blocks
==13454==    still reachable: 23,131 bytes in 129 blocks
==13454==         suppressed: 0 bytes in 0 blocks
==13454== Rerun with --leak-check=full to see details of leaked memory
==13454== 
==13454== For counts of detected and suppressed errors, rerun with: -v
==13454== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
==13453== 
==13453== HEAP SUMMARY:
==13453==     in use at exit: 14,967 bytes in 129 blocks
==13453==   total heap usage: 230 allocs, 101 frees, 88,458 bytes allocated
==13453== 
==13453== LEAK SUMMARY:
==13453==    definitely lost: 0 bytes in 0 blocks
==13453==    indirectly lost: 0 bytes in 0 blocks
==13453==      possibly lost: 0 bytes in 0 blocks
==13453==    still reachable: 14,967 bytes in 129 blocks
==13453==         suppressed: 0 bytes in 0 blocks
==13453== Rerun with --leak-check=full to see details of leaked memory
==13453== 
==13453== For counts of detected and suppressed errors, rerun with: -v
==13453== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
==13456== Warning: invalid file descriptor -1 in syscall close()
==13457== 
==13457== HEAP SUMMARY:
==13457==     in use at exit: 23,146 bytes in 129 blocks
==13457==   total heap usage: 236 allocs, 107 frees, 96,758 bytes allocated
==13457== 
==13457== LEAK SUMMARY:
==13457==    definitely lost: 0 bytes in 0 blocks
==13457==    indirectly lost: 0 bytes in 0 blocks
==13457==      possibly lost: 0 bytes in 0 blocks
==13457==    still reachable: 23,146 bytes in 129 blocks
==13457==         suppressed: 0 bytes in 0 blocks
==13457== Rerun with --leak-check=full to see details of leaked memory
==13457== 
==13457== For counts of detected and suppressed errors, rerun with: -v
==13457== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
==13456== 
==13456== HEAP SUMMARY:
==13456==     in use at exit: 14,982 bytes in 129 blocks
==13456==   total heap usage: 235 allocs, 106 frees, 88,578 bytes allocated
==13456== 
==13456== LEAK SUMMARY:
==13456==    definitely lost: 0 bytes in 0 blocks
==13456==    indirectly lost: 0 bytes in 0 blocks
==13456==      possibly lost: 0 bytes in 0 blocks
==13456==    still reachable: 14,982 bytes in 129 blocks
==13456==         suppressed: 0 bytes in 0 blocks
==13456== Rerun with --leak-check=full to see details of leaked memory
==13456== 
==13456== For counts of detected and suppressed errors, rerun with: -v
==13456== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
==13460== Warning: invalid file descriptor -1 in syscall close()
==13461== 
==13461== HEAP SUMMARY:
==13461==     in use at exit: 23,275 bytes in 131 blocks
==13461==   total heap usage: 242 allocs, 111 frees, 96,968 bytes allocated
==13461== 
==13461== LEAK SUMMARY:
==13461==    definitely lost: 0 bytes in 0 blocks
==13461==    indirectly lost: 0 bytes in 0 blocks
==13461==      possibly lost: 0 bytes in 0 blocks
==13461==    still reachable: 23,275 bytes in 131 blocks
==13461==         suppressed: 0 bytes in 0 blocks
==13461== Rerun with --leak-check=full to see details of leaked memory
==13461== 
==13461== For counts of detected and suppressed errors, rerun with: -v
==13461== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
==13460== 
==13460== HEAP SUMMARY:
==13460==     in use at exit: 15,111 bytes in 131 blocks
==13460==   total heap usage: 241 allocs, 110 frees, 88,788 bytes allocated
==13460== 
==13460== LEAK SUMMARY:
==13460==    definitely lost: 0 bytes in 0 blocks
==13460==    indirectly lost: 0 bytes in 0 blocks
==13460==      possibly lost: 0 bytes in 0 blocks
==13460==    still reachable: 15,111 bytes in 131 blocks
==13460==         suppressed: 0 bytes in 0 blocks
==13460== Rerun with --leak-check=full to see details of leaked memory
==13460== 
==13460== For counts of detected and suppressed errors, rerun with: -v
==13460== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
==13463== Warning: invalid file descriptor -1 in syscall close()
==13464== 
==13464== HEAP SUMMARY:
==13464==     in use at exit: 23,278 bytes in 131 blocks
==13464==   total heap usage: 247 allocs, 116 frees, 97,149 bytes allocated
==13464== 
==13464== LEAK SUMMARY:
==13464==    definitely lost: 0 bytes in 0 blocks
==13464==    indirectly lost: 0 bytes in 0 blocks
==13464==      possibly lost: 0 bytes in 0 blocks
==13464==    still reachable: 23,278 bytes in 131 blocks
==13464==         suppressed: 0 bytes in 0 blocks
==13464== Rerun with --leak-check=full to see details of leaked memory
==13464== 
==13464== For counts of detected and suppressed errors, rerun with: -v
==13464== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
==13463== 
==13463== HEAP SUMMARY:
==13463==     in use at exit: 15,114 bytes in 131 blocks
==13463==   total heap usage: 246 allocs, 115 frees, 88,969 bytes allocated
==13463== 
==13463== LEAK SUMMARY:
==13463==    definitely lost: 0 bytes in 0 blocks
==13463==    indirectly lost: 0 bytes in 0 blocks
==13463==      possibly lost: 0 bytes in 0 blocks
==13463==    still reachable: 15,114 bytes in 131 blocks
==13463==         suppressed: 0 bytes in 0 blocks
==13463== Rerun with --leak-check=full to see details of leaked memory
==13463== 
==13463== For counts of detected and suppressed errors, rerun with: -v
==13463== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
==13466== Warning: invalid file descriptor -1 in syscall close()
==13467== 
==13467== HEAP SUMMARY:
==13467==     in use at exit: 23,388 bytes in 131 blocks
==13467==   total heap usage: 252 allocs, 121 frees, 97,367 bytes allocated
==13467== 
==13467== LEAK SUMMARY:
==13467==    definitely lost: 0 bytes in 0 blocks
==13467==    indirectly lost: 0 bytes in 0 blocks
==13467==      possibly lost: 0 bytes in 0 blocks
==13467==    still reachable: 23,388 bytes in 131 blocks
==13467==         suppressed: 0 bytes in 0 blocks
==13467== Rerun with --leak-check=full to see details of leaked memory
==13467== 
==13467== For counts of detected and suppressed errors, rerun with: -v
==13467== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
==13466== 
==13466== HEAP SUMMARY:
==13466==     in use at exit: 15,224 bytes in 131 blocks
==13466==   total heap usage: 251 allocs, 120 frees, 89,187 bytes allocated
==13466== 
==13466== LEAK SUMMARY:
==13466==    definitely lost: 0 bytes in 0 blocks
==13466==    indirectly lost: 0 bytes in 0 blocks
==13466==      possibly lost: 0 bytes in 0 blocks
==13466==    still reachable: 15,224 bytes in 131 blocks
==13466==         suppressed: 0 bytes in 0 blocks
==13466== Rerun with --leak-check=full to see details of leaked memory
==13466== 
==13466== For counts of detected and suppressed errors, rerun with: -v
==13466== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
==13469== Warning: invalid file descriptor -1 in syscall close()
==13470== 
==13470== HEAP SUMMARY:
==13470==     in use at exit: 23,391 bytes in 131 blocks
==13470==   total heap usage: 257 allocs, 126 frees, 97,588 bytes allocated
==13470== 
==13470== LEAK SUMMARY:
==13470==    definitely lost: 0 bytes in 0 blocks
==13470==    indirectly lost: 0 bytes in 0 blocks
==13470==      possibly lost: 0 bytes in 0 blocks
==13470==    still reachable: 23,391 bytes in 131 blocks
==13470==         suppressed: 0 bytes in 0 blocks
==13470== Rerun with --leak-check=full to see details of leaked memory
==13470== 
==13470== For counts of detected and suppressed errors, rerun with: -v
==13470== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
==13469== 
==13469== HEAP SUMMARY:
==13469==     in use at exit: 15,227 bytes in 131 blocks
==13469==   total heap usage: 256 allocs, 125 frees, 89,408 bytes allocated
==13469== 
==13469== LEAK SUMMARY:
==13469==    definitely lost: 0 bytes in 0 blocks
==13469==    indirectly lost: 0 bytes in 0 blocks
==13469==      possibly lost: 0 bytes in 0 blocks
==13469==    still reachable: 15,227 bytes in 131 blocks
==13469==         suppressed: 0 bytes in 0 blocks
==13469== Rerun with --leak-check=full to see details of leaked memory
==13469== 
==13469== For counts of detected and suppressed errors, rerun with: -v
==13469== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
==13472== Warning: invalid file descriptor -1 in syscall close()
==13473== 
==13473== HEAP SUMMARY:
==13473==     in use at exit: 23,499 bytes in 131 blocks
==13473==   total heap usage: 262 allocs, 131 frees, 97,917 bytes allocated
==13473== 
==13473== LEAK SUMMARY:
==13473==    definitely lost: 0 bytes in 0 blocks
==13473==    indirectly lost: 0 bytes in 0 blocks
==13473==      possibly lost: 0 bytes in 0 blocks
==13473==    still reachable: 23,499 bytes in 131 blocks
==13473==         suppressed: 0 bytes in 0 blocks
==13473== Rerun with --leak-check=full to see details of leaked memory
==13473== 
==13473== For counts of detected and suppressed errors, rerun with: -v
==13473== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
==13472== 
==13472== HEAP SUMMARY:
==13472==     in use at exit: 15,335 bytes in 131 blocks
==13472==   total heap usage: 261 allocs, 130 frees, 89,737 bytes allocated
==13472== 
==13472== LEAK SUMMARY:
==13472==    definitely lost: 0 bytes in 0 blocks
==13472==    indirectly lost: 0 bytes in 0 blocks
==13472==      possibly lost: 0 bytes in 0 blocks
==13472==    still reachable: 15,335 bytes in 131 blocks
==13472==         suppressed: 0 bytes in 0 blocks
==13472== Rerun with --leak-check=full to see details of leaked memory
==13472== 
==13472== For counts of detected and suppressed errors, rerun with: -v
==13472== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
==13446== Warning: invalid file descriptor -1 in syscall close()
==13475== 
==13475== HEAP SUMMARY:
==13475==     in use at exit: 22,463 bytes in 130 blocks
==13475==   total heap usage: 266 allocs, 136 frees, 98,740 bytes allocated
==13475== 
==13475== LEAK SUMMARY:
==13475==    definitely lost: 0 bytes in 0 blocks
==13475==    indirectly lost: 0 bytes in 0 blocks
==13475==      possibly lost: 0 bytes in 0 blocks
==13475==    still reachable: 22,463 bytes in 130 blocks
==13475==         suppressed: 0 bytes in 0 blocks
==13475== Rerun with --leak-check=full to see details of leaked memory
==13475== 
==13475== For counts of detected and suppressed errors, rerun with: -v
==13475== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
==13446== 
==13446== HEAP SUMMARY:
==13446==     in use at exit: 13,282 bytes in 129 blocks
==13446==   total heap usage: 264 allocs, 135 frees, 90,047 bytes allocated
==13446== 
==13446== LEAK SUMMARY:
==13446==    definitely lost: 0 bytes in 0 blocks
==13446==    indirectly lost: 0 bytes in 0 blocks
==13446==      possibly lost: 0 bytes in 0 blocks
==13446==    still reachable: 13,282 bytes in 129 blocks
==13446==         suppressed: 0 bytes in 0 blocks
==13446== Rerun with --leak-check=full to see details of leaked memory
==13446== 
==13446== For counts of detected and suppressed errors, rerun with: -v
==13446== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
[ INFO] [1569513770.755880492]: Finished loading Gazebo ROS API Plugin.
[ INFO] [1569513770.756283215]: waitForService: Service [/gazebo/set_physics_properties] has not been advertised, waiting...
[INFO] [1569513771.174828, 0.000000]: Calling service /gazebo/spawn_urdf_model
[ INFO] [1569513771.195916634, 0.023000000]: waitForService: Service [/gazebo/set_physics_properties] is now available.
Warning [parser_urdf.cc:1236] multiple inconsistent <gravity> exists due to fixed joint reduction overwriting previous value [true] with [false].
Warning [parser_urdf.cc:1236] multiple inconsistent <gravity> exists due to fixed joint reduction overwriting previous value [false] with [true].
[ INFO] [1569513772.678038791, 0.125000000]: Laser Plugin: Using the 'robotNamespace' param: '/'
[ INFO] [1569513772.678107422, 0.125000000]: Starting Laser Plugin (ns = /)
[ INFO] [1569513772.680463523, 0.125000000]: Laser Plugin (ns = /)  <tf_prefix_>, set to ""
[ INFO] [1569513772.984139421, 0.125000000]: Camera Plugin: Using the 'robotNamespace' param: '/'
[ INFO] [1569513772.988030718, 0.125000000]: Camera Plugin: Using the 'robotNamespace' param: '/'
[ INFO] [1569513772.989881251, 0.125000000]: Camera Plugin (ns = /)  <tf_prefix_>, set to ""
[ INFO] [1569513772.991364043, 0.125000000]: Camera Plugin (ns = /)  <tf_prefix_>, set to ""
[ INFO] [1569513772.993889515, 0.125000000]: Camera Plugin: Using the 'robotNamespace' param: '/'
[ INFO] [1569513772.999240022, 0.125000000]: Camera Plugin: Using the 'robotNamespace' param: '/'
[ INFO] [1569513773.006935967, 0.125000000]: Camera Plugin (ns = /)  <tf_prefix_>, set to ""
[ INFO] [1569513773.025098634, 0.125000000]: Camera Plugin (ns = /)  <tf_prefix_>, set to ""
[ INFO] [1569513773.042621440, 0.125000000]: bayer simulation maybe computationally expensive.
[ WARN] [1569513773.042710689, 0.125000000]: The <focal_length>[320.000105] you have provided for camera_ [wide_stereo_l_stereo_camera_sensor] is inconsistent with specified image_width [640] and HFOV [1.570800].   Please double check to see that focal_length = width_ / (2.0 * tan(HFOV/2.0)), the explected focal_lengtth value is [319.998825], please update your camera_ model description accordingly.
[ INFO] [1569513773.044398440, 0.125000000]: bayer simulation maybe computationally expensive.
[ WARN] [1569513773.044485198, 0.125000000]: The <focal_length>[320.000105] you have provided for camera_ [wide_stereo_r_stereo_camera_sensor] is inconsistent with specified image_width [640] and HFOV [1.570800].   Please double check to see that focal_length = width_ / (2.0 * tan(HFOV/2.0)), the explected focal_lengtth value is [319.998825], please update your camera_ model description accordingly.
[ INFO] [1569513773.074322637, 0.125000000]: Camera Plugin: Using the 'robotNamespace' param: '/'
[ INFO] [1569513773.078731037, 0.125000000]: Camera Plugin: Using the 'robotNamespace' param: '/'
[ INFO] [1569513773.081757643, 0.125000000]: Camera Plugin (ns = /)  <tf_prefix_>, set to ""
[ INFO] [1569513773.084314022, 0.125000000]: Camera Plugin (ns = /)  <tf_prefix_>, set to ""
[ INFO] [1569513773.098842781, 0.125000000]: trigger_mode trigger_mode streaming
[ WARN] [1569513773.099203446, 0.125000000]: The <focal_length>[320.000105] you have provided for camera_ [l_forearm_cam_sensor] is inconsistent with specified image_width [640] and HFOV [1.570800].   Please double check to see that focal_length = width_ / (2.0 * tan(HFOV/2.0)), the explected focal_lengtth value is [319.998825], please update your camera_ model description accordingly.
[ INFO] [1569513773.775768464, 0.125000000]: Laser Plugin: Using the 'robotNamespace' param: '/'
[ INFO] [1569513773.775826138, 0.125000000]: Starting Laser Plugin (ns = /)
[ INFO] [1569513773.777002086, 0.125000000]: Laser Plugin (ns = /)  <tf_prefix_>, set to ""
[ INFO] [1569513773.798381464, 0.125000000]: Camera Plugin: Using the 'robotNamespace' param: '/'
[ INFO] [1569513773.801075468, 0.125000000]: Camera Plugin (ns = /)  <tf_prefix_>, set to ""
[ WARN] [1569513773.812511053, 0.125000000]: The <focal_length>[320.000105] you have provided for camera_ [r_forearm_cam_sensor] is inconsistent with specified image_width [640] and HFOV [1.570800].   Please double check to see that focal_length = width_ / (2.0 * tan(HFOV/2.0)), the explected focal_lengtth value is [319.998825], please update your camera_ model description accordingly.
[INFO] [1569513773.845363, 0.125000]: Spawn status: SpawnModel: Successfully spawned entity
[ INFO] [1569513773.864237580, 0.125000000]: Physics dynamic reconfigure ready.
[ INFO] [1569513773.912607340, 0.125000000]: starting gazebo_ros_controller_manager plugin in ns: /
[ INFO] [1569513773.913094029, 0.125000000]: Callback thread id=7f4d2487f700
[ INFO] [1569513773.915389709, 0.125000000]: gazebo controller manager plugin is waiting for urdf: //robot_description on the param server.  (make sure there is a rosparam by that name in the ros parameter server, otherwise, this plugin blocks simulation forever).
[ INFO] [1569513774.019387318, 0.125000000]: gazebo controller manager got pr2.xml from param server, parsing it...
[urdf_spawner-3] process has finished cleanly
log file: /home/deadmanlogan/.ros/log/12f716ec-e077-11e9-af75-68071520849c/urdf_spawner-3*.log
Segmentation fault (core dumped)
==13384== 
==13384== HEAP SUMMARY:
==13384==     in use at exit: 12,284 bytes in 120 blocks
==13384==   total heap usage: 214 allocs, 94 frees, 86,495 bytes allocated
==13384== 
==13384== LEAK SUMMARY:
==13384==    definitely lost: 0 bytes in 0 blocks
==13384==    indirectly lost: 0 bytes in 0 blocks
==13384==      possibly lost: 0 bytes in 0 blocks
==13384==    still reachable: 12,284 bytes in 120 blocks
==13384==         suppressed: 0 bytes in 0 blocks
==13384== Rerun with --leak-check=full to see details of leaked memory
==13384== 
==13384== For counts of detected and suppressed errors, rerun with: -v
==13384== ERROR SUMMARY: 0 errors from 0 contexts (suppressed: 0 from 0)
[gazebo-2] process has died [pid 13384, exit code 139, cmd valgrind /home/deadmanlogan/i_am_from_source/ros_catkin_ws/src/gazebo_ros_pkgs/gazebo_ros/scripts/gzserver -e ode worlds/empty.world __name:=gazebo __log:=/home/deadmanlogan/.ros/log/12f716ec-e077-11e9-af75-68071520849c/gazebo-2.log].
log file: /home/deadmanlogan/.ros/log/12f716ec-e077-11e9-af75-68071520849c/gazebo-2*.log

Speaking of any more details, I have Ubuntu xenial and trying to use my "launch file" to launch my robotic model in gazebo7(robotic simulation software) and this simulation software is giving segmentation fault on running my launch file. Since this launch file is readymade from Github I think probably there is no error in that launch file.

What do you think is causing the error based on my provided information?

Thread Thread
codemouse92 profile image
Jason C. McDonald Ask Me Anything

o.O

Wow, I've never seen this one before. The segfault is occurring, but Valgrind doesn't seem to be catching it.

I'm curious how you're invoking Valgrind. Usually I'd just pass the executable right to it:

$ valgrind roslaunch pr2_description pr2.launch
Thread Thread
rishabh900 profile image
all_yours

I invoked valgrind by specifying it as an option in the launch file itself and the same way i invoked gdb.

<node name="gazebo" pkg="gazebo_ros"  type="$(arg script_type)" respawn="$(arg respawn_gazebo)" output="$(arg output)" launch-prefix="valgrind"

I am very stressed with this problem but i don't want to give up.
What do you suggest for this problem?

Thread Thread
codemouse92 profile image
Jason C. McDonald Ask Me Anything • Edited

You know, I'd be really curious to know what would happen if you ran the launch file itself through Valgrind! If you look at the output from a moment ago, there's quite a lot that is occuring outside of Valgrind (all the lines not preceded with ==nnnnn== (where nnnnn is some number). The segfault at the end appears to be occuring outside of that context as well. That leads me to believe the segfault might actually be within the launch file.

Thread Thread
rishabh900 profile image
all_yours

I just ran it through valgrind

Thread Thread
Sloan, the sloth mascot
Comment deleted
Sloan, the sloth mascot
Comment deleted
Sloan, the sloth mascot
Comment deleted
Sloan, the sloth mascot
Comment deleted
Sloan, the sloth mascot
Comment deleted
Sloan, the sloth mascot
Comment deleted
Sloan, the sloth mascot
Comment deleted
Sloan, the sloth mascot
Comment deleted
codemouse92 profile image
Jason C. McDonald Ask Me Anything

Yikes. Could you delete that comment chain and put it in a Gist or bpaste.net or some such? It'll be easier to read.

In any case, that confirmed my suspicion; the launcher is the problem. it's not memory pure at all.

Thread Thread
Sloan, the sloth mascot
Comment deleted
Sloan, the sloth mascot
Comment deleted
rishabh900 profile image
all_yours

After ending the process manually I further got the output

^C[robo_state_publisher-4] killing on exit
[rosout-1] killing on exit
[master] killing on exit
shutting down processing monitor...
... shutting down processing monitor complete
done
==15557== Invalid read of size 4
==15557==    at 0x41964F: PyObject_Free (in /usr/bin/python2.7)
==15557==    by 0x4D07FA: ??? (in /usr/bin/python2.7)
==15557==    by 0x4AA262: ??? (in /usr/bin/python2.7)
==15557==    by 0x4E0C11: ??? (in /usr/bin/python2.7)
==15557==    by 0x4FC2C9: _PyModule_Clear (in /usr/bin/python2.7)
==15557==    by 0x4FBADC: PyImport_Cleanup (in /usr/bin/python2.7)
==15557==    by 0x4F8D83: Py_Finalize (in /usr/bin/python2.7)
==15557==    by 0x4936F1: Py_Main (in /usr/bin/python2.7)
==15557==    by 0x507782F: (below main) (libc-start.c:291)
==15557==  Address 0x62f2020 is 2,592 bytes inside an unallocated block of size 2,768 in arena "client"
==15557== 
==15557== Invalid read of size 4
==15557==    at 0x41964F: PyObject_Free (in /usr/bin/python2.7)
==15557==    by 0x4AA262: ??? (in /usr/bin/python2.7)
==15557==    by 0x4E0C11: ??? (in /usr/bin/python2.7)
==15557==    by 0x4FC2C9: _PyModule_Clear (in /usr/bin/python2.7)
==15557==    by 0x4FBADC: PyImport_Cleanup (in /usr/bin/python2.7)
==15557==    by 0x4F8D83: Py_Finalize (in /usr/bin/python2.7)
==15557==    by 0x4936F1: Py_Main (in /usr/bin/python2.7)
==15557==    by 0x507782F: (below main) (libc-start.c:291)
==15557==  Address 0x7f37020 is 128 bytes inside a block of size 552 free'd
==15557==    at 0x4C2EDEB: free (vg_replace_malloc.c:530)
==15557==    by 0x50C4362: fclose@@GLIBC_2.2.5 (iofclose.c:84)
==15557==    by 0x43CEFB: ??? (in /usr/bin/python2.7)
==15557==    by 0x4A63FD: PyObject_Call (in /usr/bin/python2.7)
==15557==    by 0x5385A5: _PyObject_CallMethod_SizeT (in /usr/bin/python2.7)
==15557==    by 0x53F4CE: ??? (in /usr/bin/python2.7)
==15557==    by 0x4AEF42: PyObject_CallFunctionObjArgs (in /usr/bin/python2.7)
==15557==    by 0x4BF668: PyEval_EvalFrameEx (in /usr/bin/python2.7)
==15557==    by 0x4BA915: PyEval_EvalCodeEx (in /usr/bin/python2.7)
==15557==    by 0x4C2C3B: PyEval_EvalFrameEx (in /usr/bin/python2.7)
==15557==    by 0x4BA915: PyEval_EvalCodeEx (in /usr/bin/python2.7)
==15557==    by 0x4C24E9: PyEval_EvalFrameEx (in /usr/bin/python2.7)
==15557==  Block was alloc'd at
==15557==    at 0x4C2DB8F: malloc (vg_replace_malloc.c:299)
==15557==    by 0x50C4CDC: __fopen_internal (iofopen.c:69)
==15557==    by 0x53D247: ??? (in /usr/bin/python2.7)
==15557==    by 0x4AB6FA: ??? (in /usr/bin/python2.7)
==15557==    by 0x53CDBE: ??? (in /usr/bin/python2.7)
==15557==    by 0x4BD1D9: PyEval_EvalFrameEx (in /usr/bin/python2.7)
==15557==    by 0x4BA915: PyEval_EvalCodeEx (in /usr/bin/python2.7)
==15557==    by 0x4C2C3B: PyEval_EvalFrameEx (in /usr/bin/python2.7)
==15557==    by 0x4BA915: PyEval_EvalCodeEx (in /usr/bin/python2.7)
==15557==    by 0x4C24E9: PyEval_EvalFrameEx (in /usr/bin/python2.7)
==15557==    by 0x4BA915: PyEval_EvalCodeEx (in /usr/bin/python2.7)
==15557==    by 0x4C24E9: PyEval_EvalFrameEx (in /usr/bin/python2.7)
==15557== 
==15557== Invalid read of size 4
==15557==    at 0x41964F: PyObject_Free (in /usr/bin/python2.7)
==15557==    by 0x4FC2C9: _PyModule_Clear (in /usr/bin/python2.7)
==15557==    by 0x4FBADC: PyImport_Cleanup (in /usr/bin/python2.7)
==15557==    by 0x4F8D83: Py_Finalize (in /usr/bin/python2.7)
==15557==    by 0x4936F1: Py_Main (in /usr/bin/python2.7)
==15557==    by 0x507782F: (below main) (libc-start.c:291)
==15557==  Address 0x7eea020 is 0 bytes inside a block of size 8 free'd
==15557==    at 0x4C2EDEB: free (vg_replace_malloc.c:530)
==15557==    by 0x49B1E4: ??? (in /usr/bin/python2.7)
==15557==    by 0x4D878E: ??? (in /usr/bin/python2.7)
==15557==    by 0x4BD778: PyEval_EvalFrameEx (in /usr/bin/python2.7)
==15557==    by 0x4BA915: PyEval_EvalCodeEx (in /usr/bin/python2.7)
==15557==    by 0x4D6218: ??? (in /usr/bin/python2.7)
==15557==    by 0x4EEC7D: ??? (in /usr/bin/python2.7)
==15557==    by 0x4A63FD: PyObject_Call (in /usr/bin/python2.7)
==15557==    by 0x4C6C2F: PyEval_CallObjectWithKeywords (in /usr/bin/python2.7)
==15557==    by 0x6EB480C: ??? (in /usr/lib/python2.7/lib-dynload/pyexpat.x86_64-linux-gnu.so)
==15557==    by 0x6EBCF3D: ??? (in /usr/lib/python2.7/lib-dynload/pyexpat.x86_64-linux-gnu.so)
==15557==    by 0x710D68F: ??? (in /lib/x86_64-linux-gnu/libexpat.so.1.6.0)
==15557==  Block was alloc'd at
==15557==    at 0x4C2DB8F: malloc (vg_replace_malloc.c:299)
==15557==    by 0x493F0E: PyList_New (in /usr/bin/python2.7)
==15557==    by 0x510D4D: ??? (in /usr/bin/python2.7)
==15557==    by 0x4BD1D9: PyEval_EvalFrameEx (in /usr/bin/python2.7)
==15557==    by 0x4BA915: PyEval_EvalCodeEx (in /usr/bin/python2.7)
==15557==    by 0x4D6218: ??? (in /usr/bin/python2.7)
==15557==    by 0x4EEC7D: ??? (in /usr/bin/python2.7)
==15557==    by 0x4A63FD: PyObject_Call (in /usr/bin/python2.7)
==15557==    by 0x4C6C2F: PyEval_CallObjectWithKeywords (in /usr/bin/python2.7)
==15557==    by 0x6EB480C: ??? (in /usr/lib/python2.7/lib-dynload/pyexpat.x86_64-linux-gnu.so)
==15557==    by 0x6EBCF3D: ??? (in /usr/lib/python2.7/lib-dynload/pyexpat.x86_64-linux-gnu.so)
==15557==    by 0x710D68F: ??? (in /lib/x86_64-linux-gnu/libexpat.so.1.6.0)
==15557== 
==15557== Invalid read of size 4
==15557==    at 0x41964F: PyObject_Free (in /usr/bin/python2.7)
==15557==    by 0x4D0C94: ??? (in /usr/bin/python2.7)
==15557==    by 0x4D086B: ??? (in /usr/bin/python2.7)
==15557==    by 0x4FC2C9: _PyModule_Clear (in /usr/bin/python2.7)
==15557==    by 0x4FBADC: PyImport_Cleanup (in /usr/bin/python2.7)
==15557==    by 0x4F8D83: Py_Finalize (in /usr/bin/python2.7)
==15557==    by 0x4936F1: Py_Main (in /usr/bin/python2.7)
==15557==    by 0x507782F: (below main) (libc-start.c:291)
==15557==  Address 0x611c020 is 48,736 bytes inside a block of size 49,152 free'd
==15557==    at 0x4C2EDEB: free (vg_replace_malloc.c:530)
==15557==    by 0x4AA3C4: ??? (in /usr/bin/python2.7)
==15557==    by 0x495BCA: PyDict_SetItem (in /usr/bin/python2.7)
==15557==    by 0x4FC278: _PyModule_Clear (in /usr/bin/python2.7)
==15557==    by 0x4FBADC: PyImport_Cleanup (in /usr/bin/python2.7)
==15557==    by 0x4F8D83: Py_Finalize (in /usr/bin/python2.7)
==15557==    by 0x4936F1: Py_Main (in /usr/bin/python2.7)
==15557==    by 0x507782F: (below main) (libc-start.c:291)
==15557==  Block was alloc'd at
==15557==    at 0x4C2FB55: calloc (vg_replace_malloc.c:711)
==15557==    by 0x498D2C: ??? (in /usr/bin/python2.7)
==15557==    by 0x4A252E: PyDict_Merge (in /usr/bin/python2.7)
==15557==    by 0x512275: ??? (in /usr/bin/python2.7)
==15557==    by 0x4BD1D9: PyEval_EvalFrameEx (in /usr/bin/python2.7)
==15557==    by 0x4C210E: PyEval_EvalFrameEx (in /usr/bin/python2.7)
==15557==    by 0x4BA915: PyEval_EvalCodeEx (in /usr/bin/python2.7)
==15557==    by 0x4C2C3B: PyEval_EvalFrameEx (in /usr/bin/python2.7)
==15557==    by 0x4C210E: PyEval_EvalFrameEx (in /usr/bin/python2.7)
==15557==    by 0x4C210E: PyEval_EvalFrameEx (in /usr/bin/python2.7)
==15557==    by 0x4C210E: PyEval_EvalFrameEx (in /usr/bin/python2.7)
==15557==    by 0x4C210E: PyEval_EvalFrameEx (in /usr/bin/python2.7)
==15557== 
==15557== Invalid read of size 4
==15557==    at 0x41964F: PyObject_Free (in /usr/bin/python2.7)
==15557==    by 0x4D0B76: ??? (in /usr/bin/python2.7)
==15557==    by 0x4D086B: ??? (in /usr/bin/python2.7)
==15557==    by 0x495BCA: PyDict_SetItem (in /usr/bin/python2.7)
==15557==    by 0x4FC278: _PyModule_Clear (in /usr/bin/python2.7)
==15557==    by 0x4FBBBD: PyImport_Cleanup (in /usr/bin/python2.7)
==15557==    by 0x4F8D83: Py_Finalize (in /usr/bin/python2.7)
==15557==    by 0x4936F1: Py_Main (in /usr/bin/python2.7)
==15557==    by 0x507782F: (below main) (libc-start.c:291)
==15557==  Address 0x6083020 is 3,200 bytes inside a block of size 3,218 free'd
==15557==    at 0x4C2EDEB: free (vg_replace_malloc.c:530)
==15557==    by 0x4D0A85: ??? (in /usr/bin/python2.7)
==15557==    by 0x4D086B: ??? (in /usr/bin/python2.7)
==15557==    by 0x495BCA: PyDict_SetItem (in /usr/bin/python2.7)
==15557==    by 0x4FC278: _PyModule_Clear (in /usr/bin/python2.7)
==15557==    by 0x4FBBBD: PyImport_Cleanup (in /usr/bin/python2.7)
==15557==    by 0x4F8D83: Py_Finalize (in /usr/bin/python2.7)
==15557==    by 0x4936F1: Py_Main (in /usr/bin/python2.7)
==15557==    by 0x507782F: (below main) (libc-start.c:291)
==15557==  Block was alloc'd at
==15557==    at 0x4C2DB8F: malloc (vg_replace_malloc.c:299)
==15557==    by 0x4A0021: PyString_FromStringAndSize (in /usr/bin/python2.7)
==15557==    by 0x4B3F50: ??? (in /usr/bin/python2.7)
==15557==    by 0x4B425C: ??? (in /usr/bin/python2.7)
==15557==    by 0x4B414F: ??? (in /usr/bin/python2.7)
==15557==    by 0x4B4272: ??? (in /usr/bin/python2.7)
==15557==    by 0x4B3E65: PyMarshal_ReadObjectFromString (in /usr/bin/python2.7)
==15557==    by 0x4B3DE5: PyMarshal_ReadLastObjectFromFile (in /usr/bin/python2.7)
==15557==    by 0x4B3D2D: ??? (in /usr/bin/python2.7)
==15557==    by 0x4B390B: ??? (in /usr/bin/python2.7)
==15557==    by 0x4A4C20: ??? (in /usr/bin/python2.7)
==15557==    by 0x4A42B2: PyImport_ImportModuleLevel (in /usr/bin/python2.7)
==15557== 
==15557== Conditional jump or move depends on uninitialised value(s)
==15557==    at 0x419658: PyObject_Free (in /usr/bin/python2.7)
==15557==    by 0x4D0C94: ??? (in /usr/bin/python2.7)
==15557==    by 0x4D086B: ??? (in /usr/bin/python2.7)
==15557==    by 0x4AA262: ??? (in /usr/bin/python2.7)
==15557==    by 0x4E0C11: ??? (in /usr/bin/python2.7)
==15557==    by 0x4AA0E3: ??? (in /usr/bin/python2.7)
==15557==    by 0x4E0BFB: ??? (in /usr/bin/python2.7)
==15557==    by 0x4AA262: ??? (in /usr/bin/python2.7)
==15557==    by 0x4E0C11: ??? (in /usr/bin/python2.7)
==15557==    by 0x4FC2C9: _PyModule_Clear (in /usr/bin/python2.7)
==15557==    by 0x4FBBBD: PyImport_Cleanup (in /usr/bin/python2.7)
==15557==    by 0x4F8D83: Py_Finalize (in /usr/bin/python2.7)
==15557== 
==15557== Invalid read of size 4
==15557==    at 0x502477: PyGrammar_RemoveAccelerators (in /usr/bin/python2.7)
==15557==    by 0x4F8DF3: Py_Finalize (in /usr/bin/python2.7)
==15557==    by 0x4936F1: Py_Main (in /usr/bin/python2.7)
==15557==    by 0x507782F: (below main) (libc-start.c:291)
==15557==  Address 0x615a020 is 304 bytes inside a block of size 617 free'd
==15557==    at 0x4C2EDEB: free (vg_replace_malloc.c:530)
==15557==    by 0x4D07FA: ??? (in /usr/bin/python2.7)
==15557==    by 0x4FC2C9: _PyModule_Clear (in /usr/bin/python2.7)
==15557==    by 0x4FBADC: PyImport_Cleanup (in /usr/bin/python2.7)
==15557==    by 0x4F8D83: Py_Finalize (in /usr/bin/python2.7)
==15557==    by 0x4936F1: Py_Main (in /usr/bin/python2.7)
==15557==    by 0x507782F: (below main) (libc-start.c:291)
==15557==  Block was alloc'd at
==15557==    at 0x4C2DB8F: malloc (vg_replace_malloc.c:299)
==15557==    by 0x4A0021: PyString_FromStringAndSize (in /usr/bin/python2.7)
==15557==    by 0x4B3F50: ??? (in /usr/bin/python2.7)
==15557==    by 0x4B407D: ??? (in /usr/bin/python2.7)
==15557==    by 0x4B4272: ??? (in /usr/bin/python2.7)
==15557==    by 0x4B414F: ??? (in /usr/bin/python2.7)
==15557==    by 0x4B4272: ??? (in /usr/bin/python2.7)
==15557==    by 0x4B3E65: PyMarshal_ReadObjectFromString (in /usr/bin/python2.7)
==15557==    by 0x4B3DE5: PyMarshal_ReadLastObjectFromFile (in /usr/bin/python2.7)
==15557==    by 0x4B3D2D: ??? (in /usr/bin/python2.7)
==15557==    by 0x4B390B: ??? (in /usr/bin/python2.7)
==15557==    by 0x4A4C20: ??? (in /usr/bin/python2.7)
==15557== 
==15557== 
==15557== HEAP SUMMARY:
==15557==     in use at exit: 3,393,686 bytes in 5,832 blocks
==15557==   total heap usage: 278,397 allocs, 272,565 frees, 371,732,938 bytes allocated
==15557== 
==15557== LEAK SUMMARY:
==15557==    definitely lost: 0 bytes in 0 blocks
==15557==    indirectly lost: 0 bytes in 0 blocks
==15557==      possibly lost: 55,704 bytes in 96 blocks
==15557==    still reachable: 3,337,982 bytes in 5,736 blocks
==15557==         suppressed: 0 bytes in 0 blocks
==15557== Rerun with --leak-check=full to see details of leaked memory
==15557== 
==15557== For counts of detected and suppressed errors, rerun with: -v
==15557== Use --track-origins=yes to see where uninitialised values come from
==15557== ERROR SUMMARY: 9917 errors from 128 contexts (suppressed: 0 from 0)

So this was the whole output I got , sorry for uploading this in parts(character limitation).

I hope this gives something useful to track down the issue.

Thread Thread
rishabh900 profile image
all_yours

I apologise for making such a long comment chain.
I have now made a gist of running the launch file through valgrind in

gist.github.com/rishabh900/41fd6df...

And the above comment is the output after i terminated the process manually.
So what do you think of now?

Thread Thread
codemouse92 profile image
Jason C. McDonald Ask Me Anything • Edited

Did you write the launcher script, or is that third-party? It's clearly written in Python, and the issue is definitely there. I just can't narrow in on the specific issue, because the memory issues are being thrown by the interpreter (e.g. at 0x41964F: PyObject_Free (in /usr/bin/python2.7)). That indicates that something odd has been done within the Python code, but I won't be able to diagnose this further without really fully understanding the launcher's source code, and I'm afraid I don't have time to learn it.

If this is third-party code, open an issue against the launcher project, and include the above output of Valgrind.