Skip to content

Instantly share code, notes, and snippets.

@rethink-imcmahon
Created August 31, 2015 21:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rethink-imcmahon/d3ef40c66b1b1fcdf2df to your computer and use it in GitHub Desktop.
Save rethink-imcmahon/d3ef40c66b1b1fcdf2df to your computer and use it in GitHub Desktop.
Timer Callback Execution Broken by Patch #654
Breakpoint 1 at 0x403bfb: file /data/users/imcmahon/dev/ros_core_ws/src/ros_tutorials/roscpp_tutorials/timers/timers.cpp, line 59.
(gdb) s
The program is not being run.
(gdb) run
Starting program: /data/users/imcmahon/dev/ros_core_ws/devel/lib/roscpp_tutorials/timers
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff1880700 (LWP 23552)]
[New Thread 0x7ffff107f700 (LWP 23553)]
[New Thread 0x7ffff087e700 (LWP 23554)]
[New Thread 0x7fffebfff700 (LWP 23559)]
[New Thread 0x7fffeb7fe700 (LWP 23560)]
Breakpoint 1, main (argc=1, argv=0x7fffffffd578)
at /data/users/imcmahon/dev/ros_core_ws/src/ros_tutorials/roscpp_tutorials/timers/timers.cpp:59
59 ros::spin();
(gdb) s
ros::spin () at /data/users/imcmahon/dev/ros_core_ws/src/ros_comm/clients/roscpp/src/libros/init.cpp:527
527 SingleThreadedSpinner s;
(gdb) n
528 spin(s);
(gdb) s
ros::spin (s=...) at /data/users/imcmahon/dev/ros_core_ws/src/ros_comm/clients/roscpp/src/libros/init.cpp:533
533 s.spin();
(gdb) s
ros::SingleThreadedSpinner::spin (this=0x7fffffffd310, queue=0x0)
at /data/users/imcmahon/dev/ros_core_ws/src/ros_comm/clients/roscpp/src/libros/spinner.cpp:45
45 boost::recursive_mutex::scoped_try_lock spinlock(spinmutex);
(gdb) n
46 if(!spinlock.owns_lock()) {
(gdb) n
52 ros::WallDuration timeout(0.1f);
(gdb) n
54 if (!queue)
(gdb) n
56 queue = getGlobalCallbackQueue();
(gdb) n
59 ros::NodeHandle n;
(gdb) n
60 while (n.ok())
(gdb) n
62 queue->callAvailable(timeout);
(gdb) s
ros::CallbackQueue::callAvailable (this=0x60f2a0, timeout=...)
at /data/users/imcmahon/dev/ros_core_ws/src/ros_comm/clients/roscpp/src/libros/callback_queue.cpp:292
292 setupTLS();
(gdb) n
293 TLS* tls = tls_.get();
(gdb) n
296 boost::mutex::scoped_lock lock(mutex_);
(gdb) n
298 if (!enabled_)
(gdb) n
303 if (callbacks_.empty())
(gdb) n
316 bool was_empty = tls->callbacks.empty();
(gdb) n
318 tls->callbacks.insert(tls->callbacks.end(), callbacks_.begin(), callbacks_.end());
(gdb) n
319 callbacks_.clear();
(gdb) n
321 calling_ += tls->callbacks.size();
(gdb) n
323 if (was_empty)
(gdb) n
325 tls->cb_it = tls->callbacks.begin();
(gdb) n
326 }
(gdb) n
329 size_t called = 0;
(gdb) n
331 while (!tls->callbacks.empty())
(gdb) n
333 if (callOneCB(tls) != Empty)
(gdb) n
335 ++called;
(gdb) n
331 while (!tls->callbacks.empty())
(gdb) n
333 if (callOneCB(tls) != Empty)
(gdb) s
ros::CallbackQueue::callOneCB (this=0x60f2a0, tls=0x61a1a0)
at /data/users/imcmahon/dev/ros_core_ws/src/ros_comm/clients/roscpp/src/libros/callback_queue.cpp:349
349 if (tls->calling_in_this_thread == 0xffffffffffffffffULL)
(gdb) n
351 tls->cb_it = tls->callbacks.begin();
(gdb) n
354 if (tls->cb_it == tls->callbacks.end())
(gdb) n
359 ROS_ASSERT(!tls->callbacks.empty());
(gdb) n
360 ROS_ASSERT(tls->cb_it != tls->callbacks.end());
(gdb) n
363 CallbackInfo& info = *tls->cb_it;
(gdb) n
369 CallbackInterfaceWPtr weak_cb = info.callback;
(gdb) n
371 IDInfoPtr id_info = getIDInfo(info.removal_id);
(gdb) n
372 if (id_info)
(gdb) n
374 boost::shared_lock<boost::shared_mutex> rw_lock(id_info->calling_rw_mutex);
(gdb) n
376 uint64_t last_calling = tls->calling_in_this_thread;
(gdb) n
377 tls->calling_in_this_thread = id_info->id;
(gdb) n
379 CallbackInterface::CallResult result = CallbackInterface::Invalid;
(gdb) n
381 if (info.marked_for_removal)
(gdb) n
387 tls->cb_it = tls->callbacks.erase(tls->cb_it);
(gdb) n
389 if (CallbackInterfacePtr cb = weak_cb.lock())
(gdb) n
392 }
(gdb) print weak_cb.lock()
$1 = {px = 0x0, pn = {pi_ = 0x0}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment