-
Notifications
You must be signed in to change notification settings - Fork 287
Check for nullptrs when pushing new messages to the message cache #2219
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
Conversation
Signed-off-by: Jose Faria <[email protected]>
MichaelOrlov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, but Nop. Not this way at least.
Please refer to my original response in the relevant issue #2115 (comment).
In essence, if we return false from the push method, it means that the message was lost, and this message drop will be reported on the upper layer and will be counted in statistics. This is incorrect because CircularMessageCache drops messages by design when the message queue is full, and we should not report messages lost on the upper layer.
is throwing more reasonable or would you rather just not have this in at all? asking since you already closed the original issue for it if you don't see any added value by adding an exception with a custom message I'll just close the PR |
|
Hi @jncfa, I've just spent some time making a deeper analysis of the CircularCache and its underlying CircularBuffer.
|
b800a71 to
0c54597
Compare
Signed-off-by: Jose Faria <[email protected]>
MichaelOrlov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jncfa Thanks for the follow-up.
Now looks good with one minor adjustment. Can you please update Doxygen comments for the push methods in the header files?
|
@ros-pull-request-builder retest this please |
fujitatomoya
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
Signed-off-by: jncfa <[email protected]>
Signed-off-by: Michael Orlov <[email protected]>
MichaelOrlov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note: I've pushed a commit with an update for Doxygen comment for the MessageCacheCircularBuffer::push(msg)
LGTM now.
|
Pulls: #2219 |
|
https://github.com/Mergifyio backport kilted jazzy |
✅ Backports have been created
|
) * fix: add nullptr check when pushing new messages to the message cache Signed-off-by: Jose Faria <[email protected]> * refactor: apply changes from review Signed-off-by: Jose Faria <[email protected]> * nit: update doxygen comments Signed-off-by: jncfa <[email protected]> * Update Doxygen comment for the MessageCacheCircularBuffer::push(msg) Signed-off-by: Michael Orlov <[email protected]> --------- Signed-off-by: Jose Faria <[email protected]> Signed-off-by: jncfa <[email protected]> Signed-off-by: Michael Orlov <[email protected]> Co-authored-by: Michael Orlov <[email protected]> (cherry picked from commit 572f98e) # Conflicts: # rosbag2_cpp/include/rosbag2_cpp/cache/circular_message_cache.hpp # rosbag2_cpp/src/rosbag2_cpp/cache/circular_message_cache.cpp
) * fix: add nullptr check when pushing new messages to the message cache Signed-off-by: Jose Faria <[email protected]> * refactor: apply changes from review Signed-off-by: Jose Faria <[email protected]> * nit: update doxygen comments Signed-off-by: jncfa <[email protected]> * Update Doxygen comment for the MessageCacheCircularBuffer::push(msg) Signed-off-by: Michael Orlov <[email protected]> --------- Signed-off-by: Jose Faria <[email protected]> Signed-off-by: jncfa <[email protected]> Signed-off-by: Michael Orlov <[email protected]> Co-authored-by: Michael Orlov <[email protected]> (cherry picked from commit 572f98e) # Conflicts: # rosbag2_cpp/include/rosbag2_cpp/cache/circular_message_cache.hpp # rosbag2_cpp/src/rosbag2_cpp/cache/circular_message_cache.cpp
Description
Adds a simple check to the message cache circular buffer when pushing nullptr messages.
Changed CircularMessageCache to report when dropping messages (null or too large for buffer).
Is this user-facing behavior change?
As it only adds a check if the message is a nullptr, this should not change any normal runtime behavior as this should always trigger a segmentation fault or at minimum UB.
Did you use Generative AI?
No
Additional Information