-
Notifications
You must be signed in to change notification settings - Fork 285
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
base: rolling
Are you sure you want to change the base?
Conversation
Signed-off-by: Jose Faria <[email protected]>
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]>
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 |
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
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).
Fixes #2115
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