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-#938 check for publisher destruction in does violate communication policy #1131

Conversation

elBoberido
Copy link
Member

@elBoberido elBoberido commented Feb 18, 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. Assign PR to reviewer

Notes for Reviewer

This PR checks whether the publisher port which would cause a communication policy violation is marked for destruction and destroys it before asserting the error.

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
    • Each unit test case has a unique UUID
  • Public API changes are documented via doxygen
  • Copyright owner are updated in the changed files
  • PR title describes the changes

Post-review Checklist for the PR Author

  1. All open points are addressed and tracked via issues

References

@elBoberido elBoberido added the bugfix Solves a bug label Feb 18, 2022
@elBoberido elBoberido self-assigned this Feb 18, 2022
@@ -38,7 +46,7 @@ PortManager::doesViolateCommunicationPolicy(const capro::ServiceDescription& ser

template <typename T, std::enable_if_t<std::is_same<T, iox::build::ManyToManyPolicy>::value>*>
inline cxx::optional<RuntimeName_t>
PortManager::doesViolateCommunicationPolicy(const capro::ServiceDescription& service IOX_MAYBE_UNUSED) const noexcept
PortManager::doesViolateCommunicationPolicy(const capro::ServiceDescription& service IOX_MAYBE_UNUSED) noexcept
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
PortManager::doesViolateCommunicationPolicy(const capro::ServiceDescription& service IOX_MAYBE_UNUSED) noexcept
PortManager::doesViolateCommunicationPolicy(const capro::ServiceDescription&) noexcept

@codecov
Copy link

codecov bot commented Feb 18, 2022

Codecov Report

Merging #1131 (43362df) into master (0191b3c) will increase coverage by 0.03%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1131      +/-   ##
==========================================
+ Coverage   77.23%   77.27%   +0.03%     
==========================================
  Files         346      346              
  Lines       13159    13159              
  Branches     1884     1884              
==========================================
+ Hits        10164    10168       +4     
+ Misses       2371     2369       -2     
+ Partials      624      622       -2     
Flag Coverage Δ
unittests 76.51% <100.00%> (+0.03%) ⬆️
unittests_timing 12.40% <0.00%> (-0.02%) ⬇️

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

Impacted Files Coverage Δ
...clude/iceoryx_posh/internal/roudi/port_manager.hpp 100.00% <ø> (ø)
...clude/iceoryx_posh/internal/roudi/port_manager.inl 100.00% <100.00%> (ø)
iceoryx_posh/source/roudi/port_manager.cpp 80.72% <0.00%> (+0.30%) ⬆️
iceoryx_hoofs/source/concurrent/loffli.cpp 88.57% <0.00%> (+8.57%) ⬆️

MatthiasKillat
MatthiasKillat previously approved these changes Feb 18, 2022
if (publisherPortData->m_toBeDestroyed)
{
destroyPublisherPort(publisherPortData);
continue;
Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, we ignore those that are about to be destroyed in the violation check (i.e. whether there already is such a port).

Now it might be possible that a port is about to be marked for destruction but not quite (i.e. m_toBeDestroyed == false) but we deny another port to be constructed. This is ok I guess, since we could argue that at this point the port still lives (and hence we cannot construct another one).

If so, the logic is fine.

Copy link
Member Author

Choose a reason for hiding this comment

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

@MatthiasKillat correct, we can only reason about what we know and at this point only the ones who already have the flag set are not alive animore

elfenpiff
elfenpiff previously approved these changes Feb 18, 2022
@mossmaurice mossmaurice force-pushed the iox-#938-check-for-publisher-destruction-in-does-violate-communication-policy branch from 81011e7 to 3bf9bd9 Compare February 18, 2022 16:23
mossmaurice
mossmaurice previously approved these changes Feb 18, 2022
@mossmaurice mossmaurice changed the title Iox #938 check for publisher destruction in does violate communication policy iox-#938 check for publisher destruction in does violate communication policy Feb 18, 2022
@elBoberido elBoberido force-pushed the iox-#938-check-for-publisher-destruction-in-does-violate-communication-policy branch from 3bf9bd9 to 43362df Compare February 18, 2022 17:24
@elBoberido elBoberido merged commit d53aba1 into eclipse-iceoryx:master Feb 19, 2022
@elBoberido elBoberido deleted the iox-#938-check-for-publisher-destruction-in-does-violate-communication-policy branch February 19, 2022 22:41
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.

application can't create publisher repeatedly with previous one already destroyed
4 participants