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

Allocator template for publish/subscribe pipeline #137

Merged
merged 12 commits into from
Oct 30, 2015

Conversation

jacquelinekay
Copy link
Contributor

This pull request exposes template arguments to Publisher, Subscription, AnySubscriptionCallback, and MappedRingBuffer so that a custom allocator can be passed to these entities.

  • Memory leaks in classes with Allocators. Should change raw pointer to shared pointer to handle ownership.
  • Style cleanup to make templated names less scary-looking. (I would appreciate more feedback on this; I'm considering writing macros since I repeat similar type aliases in several files.)
  • Pass allocator to shared_ptrs instantiated during runtime so that their copies and control blocks use the custom allocator.
  • Figure out how to pass allocator to shared pointers and other stdlib structures in: CallbackGroup, Executor, IntraProcessManager (add allocator to Context?)

After this PR is merged, both the intra-process and inter-process pipelines should be set up for real-time safe allocation.

@jacquelinekay jacquelinekay added the in progress Actively being worked on (Kanban column) label Oct 22, 2015
@jacquelinekay jacquelinekay self-assigned this Oct 22, 2015
@jacquelinekay
Copy link
Contributor Author

Contrary to my expectations, the branch in its current state built on the Windows Jenkins job!

http://ci.ros2.org/job/ros2_batch_ci_windows/518/

@wjwwood
Copy link
Member

wjwwood commented Oct 23, 2015

Well that's exciting.

@jacquelinekay
Copy link
Contributor Author

I tried to implement a change to Executor where I got rid of MemoryStrategy and replaced with ExecutorRuntimeState, a templated class that keeps track of all the stdlib structures that dynamically change size during the execution path, and inherits from a pure virtual non-templated base class. I ripped out a lot of the functionality of Executor (basically anything that interfaces with the lists and vectors in Executor) and put it in ExecutorRuntimeState. But then I realized it wouldn't compile because a lot of the other entities in rclcpp declare themselves as friend of Executor, and they can't declare themselves as friend of ExecutorRuntimeState without knowing about T (I think).

Back to the drawing board... I'm going to look at how to template the IntraProcessManager next.

@wjwwood
Copy link
Member

wjwwood commented Oct 24, 2015

We may be able to get rid of the friend relationships. Don't be afraid to suggest changes in the relationships between objects.

@jacquelinekay jacquelinekay force-pushed the allocator_template branch 3 times, most recently from 25fe598 to b4c7cb1 Compare October 27, 2015 01:54
@jacquelinekay jacquelinekay added in review Waiting for review (Kanban column) and removed in progress Actively being worked on (Kanban column) labels Oct 27, 2015
@jacquelinekay
Copy link
Contributor Author

@dirk-thomas
Copy link
Member

New code should pass cpplint.

Btw. the jobs are failing to compile.

namespace allocator
{

template<typename U, typename Alloc>
Copy link
Member

Choose a reason for hiding this comment

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

What does the U stand for? If nothing specific I would recommend to use the common variable T for template typenames.

Same below.

@jacquelinekay
Copy link
Contributor Author

Another set of CI jobs.

I'm going to wait on a clean set of CI before squashing, just in case:

http://ci.ros2.org/job/ros2_batch_ci_linux/511/
http://ci.ros2.org/job/ros2_batch_ci_osx/392/
http://ci.ros2.org/job/ros2_batch_ci_windows/543/

@dirk-thomas
Copy link
Member

Why do you think the Linux CI job is broken?

@jacquelinekay
Copy link
Contributor Author

there are two jobs pending that haven't started yet, and they've both been pending for a few minutes.

@dirk-thomas
Copy link
Member

This job is currently running on the Linux slave: http://ci.ros2.org/view/packaging/job/ros2_packaging_linux/

@jacquelinekay
Copy link
Contributor Author

There are a lot of regressions. But many of them exist in the nightly build:

http://ci.ros2.org/view/nightly/job/ros2_batch_ci_osx_nightly/94/testReport/
vs.
http://ci.ros2.org/job/ros2_batch_ci_osx/393/testReport/

On Linux, the allocator test doesn't work, probably because the backtrace trick only works when the code is compiled in Debug mode. I will change the test so that it fails if the number of allocations during execution per call to "spin" exceeds a set number, which is not as great.

I'm not sure where many of the regressions in Windows are coming from: the nightly build has 86 failures and the CI for this branch has 214 failures. I am rerunning Windows CI on default just to compare.

@dirk-thomas
Copy link
Member

For some of the failing tests (nose.failure.Failure.runTest) there are PRs which are only waiting for reviews...

@esteve
Copy link
Member

esteve commented Oct 30, 2015

+1 I just ran this on Windows and the tests pass

jacquelinekay added a commit that referenced this pull request Oct 30, 2015
Allocator template for publish/subscribe pipeline
@jacquelinekay jacquelinekay merged commit 010fa3d into master Oct 30, 2015
@jacquelinekay jacquelinekay removed the in review Waiting for review (Kanban column) label Oct 30, 2015
@jacquelinekay jacquelinekay deleted the allocator_template branch October 30, 2015 00:15
nnmm pushed a commit to ApexAI/rclcpp that referenced this pull request Jul 9, 2022
* fix documentation of expand_topic_name()

* use expand_topic_name() in pub/sub/client/service

* update test expectations

* use absolute topic names to avoid mismatch due to expansion

* propagate new functions from rcutils error handling

* convert given rcl allocator to a rcutils allocator
DensoADAS pushed a commit to DensoADAS/rclcpp that referenced this pull request Aug 5, 2022
* ros2GH-118 Make rosbag2::Writer use converters

- Use converters in Writer::write() when input rmw serialization format is different from desired storage serialization format
- Add new field in rosbag2::StorageOptions to keep track of the rmw format given by the user to store the message in

* ros2GH-118 Add --encoding option to ros2 bag record

* ros2GH-118 Associate to each topic its rmw_serialization_format

- Add 'serialization_format' field to TopicMetadata
- Add 'serialization_forat' column in 'topics' table in sqlite storage
- Remove 'storage_format' from BagMetadata and use the TopicMetadata field directly, instead
- the field 'rmw_serialization_format' has been moved from rosbag2::StorageOptions to rosbag2_transport::RecordOptions, because it's a topic property rather than a storage one.
- Currently all topics in a bag file must have the same serialization format
- The tests have been updated accordingly

* ros2GH-118 Fix tests after rebase

* ros2GH-118 Fix MockMetadataIO and use it in test_writer

* ros2GH-118 Fix Windows build and minor refactoring

* ros2GH-118 Add test for writer to check that error is thrown if converter plugin does not exist

* ros2GH-118 Add test to check that metadat_io_ writes metadata file in writer's destructor

* ros2GH-118 Build Converter before opening the database in Writer::open()

- This assures that if one of the converter plugins does not exist, the database is not created

* ros2GH-118 Add end-to-end tests to check graceful failure if converter plugins do not exists

- Both a test for record and play has been added

* ros2GH-118 Rename 'encoding' CLI option to 'serialization_format'

* ros2GH-127 Write serialization format in database also when it's not specified at CLI level

- Tests to check that the serialization format is written in the database have also been added.

* ros2GH-17 Add leak sanitizer to test

- one of the main test goals can only be ssen by valgrind or sanitizers
- enable leak sanitizer for gcc builds only (for now)

* ros2GH-137: Fix cdr converter plugin

- update pluginlib descriptions file after several renames
- fix export of missing includes folder

* ros2GH-137 Add integration test for cdr converter

* ros2GH-137 Fix superfluous printf

* ros2GH-137 It suffices to have only one converter test

* ros2GH-137 Minor refactoring for better readability of test

N.B. This exposes an pre-existing memory leak (not fixed here).

* ros2GH-137 Fix memory leak of topic_name

- topic_name member needs to be freed
- provide a setter for convenience
- Directly assigning a string literal in the test is not sufficient as
  this would be static memory that does not need to be freed.

* ros2GH-17 Allow disabling the usage of sanitizers

This allows manual usage of valgrind.

* ros2GH-17 Fix renaming after rebase

* ros2GH-17 Small cleanups (addressing review comments)
DensoADAS pushed a commit to DensoADAS/rclcpp that referenced this pull request Aug 5, 2022
…2#137)

Signed-off-by: ivanpauno <ivanpauno@ekumenlabs.com>
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