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

Remove egregious error of removing from a set being range iterated over #9796

Conversation

SeanCurtis-TRI
Copy link
Contributor

@SeanCurtis-TRI SeanCurtis-TRI commented Oct 24, 2018

Addresses issue #9791


This change is Reviewable

Copy link
Contributor Author

@SeanCurtis-TRI SeanCurtis-TRI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+@RussTedrake for feature review (and feel free to steal the patch in the short-term if you have to.)

Reviewable status: :shipit: complete! all discussions resolved, Exempt from platform review

Copy link
Member

@sherm1 sherm1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Feature :lgtm: in case you need one.

Reviewed 1 of 1 files at r1.
Reviewable status: all discussions resolved, LGTM missing from assignee russtedrake, Exempt from platform review

Copy link
Contributor Author

@SeanCurtis-TRI SeanCurtis-TRI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @sherm1. The more interesting question here is the conspicuous absence of a test. I'd love to reproduce the failure condition @RussTedrake had and commit a test with this fix to bolster up its claim to being a fix.

Reviewable status: all discussions resolved, LGTM missing from assignee russtedrake, Exempt from platform review

@RussTedrake
Copy link
Contributor

Now it fails at

abort: Failure at geometry/dev/geometry_state.cc:259 in operator=(): condition 'moved.size() > 0' failed.

Copy link
Contributor Author

@SeanCurtis-TRI SeanCurtis-TRI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nominally addressed offline.

Reviewable status: all discussions resolved, LGTM missing from assignee russtedrake, Exempt from platform review

@RussTedrake
Copy link
Contributor

fwiw -- we managed to "figure out" a way to make the world_id consistently 1 for both python and c++, but there was still come confusion on why the apple object was being treated incorrectly (even if world_id == 2).

@RussTedrake
Copy link
Contributor

the "fix" we figured out this afternoon is here:
RussTedrake@e2d71df

@jwnimmer-tri
Copy link
Collaborator

The fix is an improvement, at least. GSG prohibits non-POD globals, for good reason. (The fix should use never_destroyed, though.)

If you are having problems with globals in python vs C++ though, I wonder if you're hitting the ODR problems? Ah, yes -- depending on //examples/manipulation_station from a pydrake module as in https://github.com/RussTedrake/drake/blob/f62df45/bindings/pydrake/examples/BUILD.bazel#L66 is abusing the linker, and will give you multiple independent copies of your globals. You should add the manipulation_station to the install/libdrake list of bazel packages to link into libdrake.so, not deps on it directly.

@sherm1
Copy link
Member

sherm1 commented Oct 25, 2018

FrameId is a POD (just an int64_t) so shouldn't require never_destroyed.

@jwnimmer-tri
Copy link
Collaborator

jwnimmer-tri commented Oct 25, 2018

Its API contract does not promise that nobody will ever add a dtor (that is always trivially destructible). You could imagine someone adding value_ = 0; in debug builds. Better safe than sorry. Better to always use never_destroyed for globals, so its easy to cargo-cult successfully without being a C++ expert.

Copy link
Contributor Author

@SeanCurtis-TRI SeanCurtis-TRI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@RussTedrake given this is a patch to a dev branch (and it definitely addresses a defect) we should merge this. @sherm1 provided an LGTM so you can either unassign yourself or review this change. I leave it up to you.

Reviewable status: all discussions resolved, LGTM missing from assignee russtedrake, Exempt from platform review

@RussTedrake RussTedrake removed their assignment Oct 26, 2018
Copy link
Contributor

@RussTedrake RussTedrake left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-@RussTedrake

Reviewable status: all discussions resolved, LGTM missing from assignee russtedrake, Exempt from platform review

@SeanCurtis-TRI SeanCurtis-TRI merged commit 3ef23d7 into RobotLocomotion:master Oct 26, 2018
@SeanCurtis-TRI SeanCurtis-TRI deleted the PR_fix_dev_scene_graph_conversion branch October 26, 2018 17:36
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.

4 participants