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

iox-#1575 Properly initialize ServiceRegistry in shared memory #1583

Conversation

mossmaurice
Copy link
Contributor

@mossmaurice mossmaurice commented Aug 17, 2022

Pre-Review Checklist for the PR Author

  1. Code follows the coding style of CONTRIBUTING.md
  2. Tests follow the best practice for testing
  3. Changelog updated in the unreleased section including API breaking changes
  4. Branch follows the naming format (iox-123-this-is-a-branch)
  5. Commits messages are according to this guideline
    • Commit messages have the issue ID (iox-#123 commit text)
    • Commit messages are signed (git commit -s)
    • Commit author matches Eclipse Contributor Agreement (and ECA is signed)
  6. Update the PR title
    • Follow the same conventions as for commit messages
    • Link to the relevant issue
  7. Relevant issues are linked
  8. Add sensible notes for the reviewer
  9. All checks have passed (except task-list-completed)
  10. All touched (C/C++) source code files are added to ./clang-tidy-diff-scans.txt not done for posh
  11. Assign PR to reviewer

Notes for Reviewer

  • Fixes a bug, that would call vector::operator=(const vector&) on uninitialized data
    • No test was added as the false behavior relies on shared memory not being initialized, which can not be always reproduced (see below)
// Call stack before the bugfix

ServiceRegistry::operator=(const ServiceRegistry& rhs) (implicitly defined)
  |
   -- >  vector::operator=(const vector& rhs)
         |
         --> With certain compiler/compiler settings: vector::size() != 0, leading to false execution of copy assignment branch (at(i) = rhs.at(i))

// Call stack after the bugfix

ServiceRegistry::ServiceRegistry(const ServiceRegistry& rhs) (implicitly defined, ensures that all member variables are properly initialized)
  |
   -- >  vector::vector(const vector& rhs)
         |
         --> vector::operator=(const vector& rhs)
               |
               --> vector::size() == 0 is ensured, leading to correct execution of copy c'tor branch (emplace_back(rhs.at(i)))

Checklist for the PR Reviewer

  • Commits are properly organized and messages are according to the guideline
  • Code according to our coding style and naming conventions
  • Unit tests have been written for new behavior
  • Public API changes are documented via doxygen
  • Copyright owner are updated in the changed files
  • [ ] All touched (C/C++) source code files have been added to ./clang-tidy-diff-scans.txt
  • PR title describes the changes

Post-review Checklist for the PR Author

  1. All open points are addressed and tracked via issues

References

Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai>
…istry bugfix

Signed-off-by: Simon Hoinkis <simon.hoinkis@apex.ai>
@mossmaurice mossmaurice added the bugfix Solves a bug label Aug 17, 2022
@mossmaurice mossmaurice self-assigned this Aug 17, 2022
@codecov
Copy link

codecov bot commented Aug 17, 2022

Codecov Report

Merging #1583 (47c7e96) into master (d2dd5b2) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1583      +/-   ##
==========================================
- Coverage   76.37%   76.36%   -0.02%     
==========================================
  Files         360      360              
  Lines       13865    13864       -1     
  Branches     1941     1941              
==========================================
- Hits        10590    10587       -3     
  Misses       2702     2702              
- Partials      573      575       +2     
Flag Coverage Δ
unittests 76.00% <100.00%> (-0.02%) ⬇️
unittests_timing 15.57% <0.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
iceoryx_posh/source/roudi/port_manager.cpp 84.21% <100.00%> (-0.22%) ⬇️
iceoryx_hoofs/source/concurrent/loffli.cpp 88.57% <0.00%> (-2.86%) ⬇️

Copy link
Member

@dkroenke dkroenke left a comment

Choose a reason for hiding this comment

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

LGTM

@mossmaurice mossmaurice merged commit 05e8ef6 into eclipse-iceoryx:master Aug 19, 2022
@mossmaurice mossmaurice deleted the iox-#1575-initialize-service-registry branch August 19, 2022 11:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugfix Solves a bug
Projects
None yet
Development

Successfully merging this pull request may close these issues.

RouDi crash in publishServiceRegistry when assigning to unzeroized allocated chunk
3 participants