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

ros_realtime: Publisher is crashing during destruction #3

Open
ablasdel opened this issue Jan 29, 2013 · 1 comment
Open

ros_realtime: Publisher is crashing during destruction #3

ablasdel opened this issue Jan 29, 2013 · 1 comment
Labels

Comments

@ablasdel
Copy link

Migrated from code.ros.org, issue #2877
Reported by: sglaser

https://code.ros.org/trac/ros/ticket/2877

I'm bringing up a nodelet which brings up a rosrt publisher, and then bringing down the nodelet and it crashes:

Program received signal SIGTRAP, Trace/breakpoint trap.
[Switching to Thread 0x7f167cff9950 (LWP 9727)]
ros::Publisher::publish<tirt_controller::JointSetpoint_<std::allocator<void> > const> (this=0x7f16940ef458, message=@0x0)
    at /u/sglaser/ros/ros/core/roscpp/include/ros/publisher.h:85
85        }
Current language:  auto; currently c++
(gdb) bt
#0  ros::Publisher::publish<tirt_controller::JointSetpoint_<std::allocator<void> > const> (this=0x7f16940ef458, message=@0x0)
    at /u/sglaser/ros/ros/core/roscpp/include/ros/publisher.h:85
#1  0x00007f168fdf2c32 in rosrt::detail::publishMessage<tirt_controller::JointSetpoint_<std::allocator<void> > > (pub=@0x7f16bb532720,
    msg=<value optimized out>) at /u/sglaser/ros/stacks/ros_realtime/rosrt/include/rosrt/publisher.h:59
#2  0x00007f1684f8f146 in rosrt::detail::PublishQueue::publishAll (this=<value optimized out>)
    at /u/sglaser/ros/stacks/ros_realtime/rosrt/src/publisher.cpp:80
#3  0x00007f1684f8f373 in rosrt::detail::PublisherManager::publishThread (this=0x7f1680066ce0)
    at /u/sglaser/ros/stacks/ros_realtime/rosrt/src/publisher.cpp:126
#4  0x00007f16bb102a0e in thread_proxy () from /opt/ros/lib/libboost_thread.so.1.40.0
#5  0x00007f16b98ef3ba in start_thread () from /lib/libpthread.so.0
#6  0x00007f16b965c02d in clone () from /lib/libc.so.6
#7  0x0000000000000000 in ?? ()

Not sure why this is dying, but it is consistent.

@ablasdel
Copy link
Author

Changed 3 years ago by sglaser

Here's the code doing the publishing:

  void update(ros::Time time)
  {
    tirt_controller::JointSetpoint::Ptr setpoint;
    if (setpoint = pub_setpoint_.allocate())
    {
      setpoint->mode = tirt_controller::JointSetpoint::POSITION;
      double scale = 2 * M_PI / period_;
      setpoint->position = amplitude_ * sin(time.toSec() * scale) + offset_;
      setpoint->velocity = amplitude_ * scale * cos(time.toSec() * scale);
      pub_setpoint_.publish(setpoint);
    }
    else
      ROS_ERROR_THROTTLE(5.0, "Runout");
  }

Looks like the publisher is invalid:

(gdb) frame 1
#1  0x00007f82666cdc32 in rosrt::detail::publishMessage<tirt_controller::JointSetpoint_<std::allocator<void> > > (pub=@0x7f829535e720, 
    msg=<value optimized out>) at /u/sglaser/ros/stacks/ros_realtime/rosrt/include/rosrt/publisher.h:59
59        pub.publish(m);
(gdb) p m
$2 = {px = 0x7f825c000da0, pn = {pi_ = 0x7f825c064bc0}}
(gdb) p pub
$3 = (const ros::Publisher &) @0x7f829535e720: {impl_ = {px = 0x0, pn = {pi_ = 0x0}}}

Other things for curiosity's sake:

(gdb) frame 2
#2  0x00007f826b2f2146 in rosrt::detail::PublishQueue::publishAll (this=<value optimized out>)
    at /u/sglaser/ros/stacks/ros_realtime/rosrt/src/publisher.cpp:80
80          it->val.pub_func(it->val.pub, clone);
(gdb) p count
$4 = 34

What's particularly odd is that this publisher was successfully publishing for a while, and it is only on shutdown that it suddenly goes NULL.
Changed 3 years ago by jfaust

My guess is it's because you've removed the code segment for that publisher (and what it's referencing) from memory. Does it happen if the publisher is just destroyed, but the nodelet is not unloaded?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant