Skip to content

[25475] Catch exception when constructing a payload pool Node#6460

Merged
MiguelCompany merged 4 commits into
masterfrom
bugfix/25475
Jul 1, 2026
Merged

[25475] Catch exception when constructing a payload pool Node#6460
MiguelCompany merged 4 commits into
masterfrom
bugfix/25475

Conversation

@MiguelCompany

@MiguelCompany MiguelCompany commented Jul 1, 2026

Copy link
Copy Markdown
Member

Description

Fixes a common misuse of std::nothrow. Calling new (std::nothrow) T() only avoids throwing when allocating T, but exceptions thrown when executing T's constructor are not avoided.

This fixes the problem by capturing std::bad_alloc when creating the node.

A regression test is also added.

@Mergifyio backport 3.2.x 2.14.x

Contributor Checklist

  • Commit messages follow the project guidelines.
  • The code follows the style guidelines of this project.
  • Tests that thoroughly check the new feature have been added/Regression tests checking the bug and its fix have been added; the added tests pass locally
  • Any new/modified methods have been properly documented using Doxygen.
  • N/A: Any new configuration API has an equivalent XML API (with the corresponding XSD extension)
  • Changes are backport compatible: they do NOT break ABI nor change library core behavior.
  • Changes are API compatible.
  • N/A: New feature has been added to the versions.md file (if applicable).
  • N/A: New feature has been documented/Current behavior is correctly described in the documentation.
  • Applicable backports have been included in the description.

Reviewer Checklist

  • The PR has a milestone assigned.
  • The title and description correctly express the PR's purpose.
  • Check contributor checklist is correct.
  • N/A: If this is a critical bug fix, backports to the critical-only supported branches have been requested.
  • Check CI results: changes do not issue any warning.
  • Check CI results: failing tests are unrelated with the changes.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
@MiguelCompany MiguelCompany added this to the v3.6.3 milestone Jul 1, 2026
@github-actions github-actions Bot added the ci-pending PR which CI is running label Jul 1, 2026

@ZakariaTalbi ZakariaTalbi left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@MiguelCompany

Copy link
Copy Markdown
Member Author

@Mergifyio backport 3.2.x 2.14.x

@mergify

mergify Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

backport 3.2.x 2.14.x

✅ Backports have been created

Details

@mergify

mergify Bot commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@MiguelCompany
MiguelCompany merged commit 31ece6f into master Jul 1, 2026
38 of 39 checks passed
@MiguelCompany
MiguelCompany deleted the bugfix/25475 branch July 1, 2026 19:29
MiguelCompany added a commit that referenced this pull request Jul 2, 2026
* Refs #25475. Regression test.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #25475. Capture exception when constructing PayloadNode.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #25475. Bonus: avoid using sizeof(NodeInfo).

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #25475. Fix uncrustify.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

---------

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
(cherry picked from commit 31ece6f)
MiguelCompany added a commit that referenced this pull request Jul 3, 2026
* Refs #25475. Regression test.



* Refs #25475. Capture exception when constructing PayloadNode.



* Refs #25475. Bonus: avoid using sizeof(NodeInfo).



* Refs #25475. Fix uncrustify.



---------


(cherry picked from commit 31ece6f)

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
Co-authored-by: Miguel Company <miguelcompany@eprosima.com>
MiguelCompany added a commit that referenced this pull request Jul 3, 2026
* Refs #25475. Regression test.



* Refs #25475. Capture exception when constructing PayloadNode.



* Refs #25475. Bonus: avoid using sizeof(NodeInfo).



* Refs #25475. Fix uncrustify.



---------


(cherry picked from commit 31ece6f)

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
Co-authored-by: Miguel Company <miguelcompany@eprosima.com>
@MiguelCompany

Copy link
Copy Markdown
Member Author

@Mergifyio backport 2.6.x

@mergify

mergify Bot commented Jul 3, 2026

Copy link
Copy Markdown
Contributor

backport 2.6.x

✅ Backports have been created

Details

Cherry-pick of 31ece6f has failed:

On branch mergify/bp/2.6.x/pr-6460
Your branch is up to date with 'origin/2.6.x'.

You are currently cherry-picking commit 31ece6fdc.
  (fix conflicts and run "git cherry-pick --continue")
  (use "git cherry-pick --skip" to skip this patch)
  (use "git cherry-pick --abort" to cancel the cherry-pick operation)

Changes to be committed:
	modified:   src/cpp/rtps/history/TopicPayloadPool.cpp

Unmerged paths:
  (use "git add <file>..." to mark resolution)
	both modified:   src/cpp/rtps/history/TopicPayloadPool.hpp
	both modified:   test/unittest/rtps/history/TopicPayloadPoolTests.cpp

To fix up this pull request, you can check it out locally. See documentation: https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/reviewing-changes-in-pull-requests/checking-out-pull-requests-locally

MiguelCompany added a commit that referenced this pull request Jul 3, 2026
* Refs #25475. Regression test.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #25475. Capture exception when constructing PayloadNode.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #25475. Bonus: avoid using sizeof(NodeInfo).

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

* Refs #25475. Fix uncrustify.

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>

---------

Signed-off-by: Miguel Company <miguelcompany@eprosima.com>
(cherry picked from commit 31ece6f)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-pending PR which CI is running

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants