-
Notifications
You must be signed in to change notification settings - Fork 276
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 seg fault in SetRemovedComponentsMsgs
when TransformControl tool is used
#495
Fix seg fault in SetRemovedComponentsMsgs
when TransformControl tool is used
#495
Conversation
Signed-off-by: mrushyendra <[email protected]>
17e79ac
to
6afa9eb
Compare
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.
confirmed that this fixed the issue.
As for the second point, is the idea for passing in _types
to skip adding components to the msg if they are not in _types?
Signed-off-by: mrushyendra <[email protected]>
Yeah, that's what I meant |
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.
Just for another data point it also fixes the issue in our simulations
I see. I'm not sure if we should apply the filter to removed components or not actually. Maybe @chapulina or @azeey may have a better idea? |
I don't believe it was intentional. I think adding the filter would be a good idea. |
Signed-off-by: mrushyendra <[email protected]>
…-gazebo into fix_remove_component_msg_segfault
…m/mrushyendra/ign-gazebo into fix_remove_component_msg_segfault
Just added the filter as well |
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.
the latest changes look good to me
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.
All changes look good to me. I hope no users were expecting the _types
filter not to be applied to the removed components, because that would break their expectation.
Do you think you could add some tests to check that the removed types are filtered correctly, @mrushyendra ? It would also be great to add a test for the situation where SetRemovedComponentsMsgs
is called on an entity that doesn't have changed components.
Thanks!
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! I agree with @chapulina, tests would be great!
Verifies the message created in situations where components are only removed but not changed, and when a list of types to filter is passed to the function. Signed-off-by: Maganty Rushyendra <[email protected]>
9b66519
to
8164cd5
Compare
Added a couple of tests |
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.
CI fails on macOS with the error
9: /Users/jenkins/workspace/ignition_gazebo-ci-pr_any-homebrew-amd64/ign-gazebo/src/EntityComponentManager_TEST.cc:2337: Failure
9: Expected equality of these values:
9: e1Msg.components().size()
9: Which is: 0
9: 1u
9: Which is: 1
9/156 Test #9: UNIT_EntityComponentManager_TEST .....................***Exception: SegFault 14.53 sec
test 10
I've left comments to change EXPECT_EQ
to ASSERT_EQ
, but I'm not sure why the test failed.
Signed-off-by: Maganty Rushyendra <[email protected]>
The tests should be passing now. Had to change the |
All tests are passing now (the only failure for macOS is for |
_msg.mutable_entities()
need not necessarily contain the_entity
as a key whenSetRemovedComponentsMsgs()
is called, for instance inAddEntityToMessage()
. In the case where_entity
has no components inentityComponents
that changed, but does have some removed Components inremovedComponents
, this could lead to a seg fault whenAddEntityToMessage
callsSetRemovedComponentsMsgs
.Secondly, this is only tangentially related, but it looks like
AddEntityToMessage
also takes a list of component types_types
:https://github.com/ignitionrobotics/ign-gazebo/blob/2f7f33d4fa34657badec81558d5953fe7643769f/src/EntityComponentManager.cc#L849-L851
But this is currently ignored in the call to
SetRemovedComponentMsgs
. I was wondering if that was intentional, or if it should be modified as well?Fixes #483