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

Import rosbag2_transport Python module on demand #190

Merged
merged 2 commits into from
Oct 21, 2019

Conversation

hidmic
Copy link
Contributor

@hidmic hidmic commented Oct 21, 2019

Closes #179. This pull request ensure ros2bag imports rosbag2_transport on demand, as opposed to doing so at the module level.

I purposefully didn't rehash the rosbag2_transport module to enforce delayed imports as there's been some discussion and work around removing this limitation, and hopefully we might at some point in the future (see ros2/rclpy#417, ros2/rclpy#420 and ros2/rclpy#422).

Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
@dirk-thomas
Copy link
Member

LGTM as a short term fix. The better solution in my opinion would be if the Python module wouldn't create and populate a global variable in the module scope but expose a function to be called instead. That would avoid the problem that this issues pops up again when new code imports the module.

@hidmic
Copy link
Contributor Author

hidmic commented Oct 21, 2019

@dirk-thomas I believe either of the two are short-term fixes. Importing a C extension shouldn't require such measures nor care. And it actually does not everywhere else but on Windows. That's the true limitation that has to be removed IMHO.

@hidmic
Copy link
Contributor Author

hidmic commented Oct 21, 2019

CI (up to rosbag2_tests)

  • Linux Build Status
  • Linux-aarch64 Build Status
  • macOS Build Status
  • Windows Build Status

Copy link
Collaborator

@Karsten1987 Karsten1987 left a comment

Choose a reason for hiding this comment

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

As discussed offline, I am okay with that patch.
However, I'd demand some documentation or pointers for me to re-iterate over this once we found a decent solution in the future. As for now, I understand the problem, but I don't have enough insights to come up with a qualified feedback on this and therefore trust on your opinions.

Signed-off-by: Michel Hidalgo <michel@ekumenlabs.com>
@hidmic
Copy link
Contributor Author

hidmic commented Oct 21, 2019

@Karsten1987 see 3b2c58a. I'm also testing this on a Windows VM, reproducing the situation in which it first showed itself. I'll keep you posted.

@hidmic
Copy link
Contributor Author

hidmic commented Oct 21, 2019

Alright, DLL issues are gone! We're good to go. @mjcarroll may I have your blessing?

@hidmic hidmic merged commit 57ee61d into master Oct 21, 2019
@delete-merged-branch delete-merged-branch bot deleted the hidmic/import-c-ext-on-demand branch October 21, 2019 21:13
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.

rosbag2_transport cannot be found on Windows
4 participants