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

Fix bookkeeping of ongoing calls for recursive calls to CallbackQueue::callAvailable() #2378

Open
wants to merge 1 commit into
base: noetic-devel
Choose a base branch
from

Conversation

meyerj
Copy link
Contributor

@meyerj meyerj commented Oct 8, 2024

While investigating a segmentation fault in one of our applications, and while working on #2377 yesterday, I found another small possible bug in the implementation of ros::CallbackQueue::callAvailable() in the way it keeps track of how many callbacks are currently being executed in any spinner thread, namely the calling_ variable.

When copying over pending calls to the thread-local callback queue held in tls->callbacks, the calling_ member was not updated correctly with the number of added callbacks if tls->callbacks was not empty before. This may be the case if callAvailable() is called recursively, e.g. from within another callback.

The issue should only affect the calling_ member and empty() and isEmpty() member functions, which apparently are unused within roscpp itself, but may be used by external code.

…::callAvailable()

When copying over pending calls to the thread-local callback queue held in tls->callbacks, the calling_
member was not updated correctly with the number of added callbacks if tls->callbacks was not empty before.
This may be the case if callAvailable() is called recursively, e.g. from within another callback.

The issue should only affect the empty() and isEmpty() member functions, which apparently are unused
within the CallbackQueue class or within roscpp itself, but may be used by external code.

Signed-off-by: Johannes Meyer <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant