Skip to content

[23655] Solve TCP disconnect while incomplete read deadlock (backport #6066)#6090

Merged
juanlofer-eprosima merged 1 commit into3.3.xfrom
mergify/bp/3.3.x/pr-6066
Oct 13, 2025
Merged

[23655] Solve TCP disconnect while incomplete read deadlock (backport #6066)#6090
juanlofer-eprosima merged 1 commit into3.3.xfrom
mergify/bp/3.3.x/pr-6066

Conversation

@mergify
Copy link
Copy Markdown
Contributor

@mergify mergify bot commented Oct 9, 2025

Description

This PR attempts to solve the deadlock produced when a read operation never completes (e.g. peer blocks before ending a transmission), and the TCP channel resource is disconnected (normally on closure while cleaning the associated transport).
Summing up, the solution consists in shutting down the socket before acquiring the culprit read mutex, so that any ongoing write/read operations are aborted even if not completed.

In addition, some other changes in this PR target general thread safety and attempt to improve overall resilience:

  • New "disconnecting" state to protect from concurrent connect/disconnects.
  • Assert that socket options are only configured before connection is established.

@Mergifyio backport 3.3.x 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

  • N/a 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.

This is an automatic backport of pull request #6066 done by [Mergify](https://mergify.com).

* Refs #23655. Add regression test

Signed-off-by: Juan Lopez Fernandez <juanlopez@eprosima.com>

* Refs #23655. Solve deadlock and improve thread safety

Signed-off-by: Juan Lopez Fernandez <juanlopez@eprosima.com>

* Refs #23655. Bonus track: protect status getter

Signed-off-by: Juan Lopez Fernandez <juanlopez@eprosima.com>

* Refs #23655. Fix test in Windows

Signed-off-by: Juan Lopez Fernandez <juanlopez@eprosima.com>

* Refs #23655. Remove deprecated code

Signed-off-by: Juan Lopez Fernandez <juanlopez@eprosima.com>

* Refs #23655. Restore noexcept overloads usage

Signed-off-by: Juan Lopez Fernandez <juanlopez@eprosima.com>

* Refs #23655. Apply suggestions

Signed-off-by: Juan Lopez Fernandez <juanlopez@eprosima.com>

---------

Signed-off-by: Juan Lopez Fernandez <juanlopez@eprosima.com>
(cherry picked from commit f2e173c)
@juanlofer-eprosima juanlofer-eprosima added this to the v3.3.1 milestone Oct 9, 2025
@juanlofer-eprosima juanlofer-eprosima requested review from richiprosima and removed request for richiprosima October 9, 2025 14:39
@github-actions github-actions bot added the ci-pending PR which CI is running label Oct 9, 2025
@juanlofer-eprosima juanlofer-eprosima requested review from richiprosima and removed request for richiprosima October 10, 2025 12:21
@mergify
Copy link
Copy Markdown
Contributor Author

mergify bot commented Oct 10, 2025

🧪 CI Insights

Here's what we observed from your CI run for 2cd2c01.

❌ Job Failures

Pipeline Job Health on 3.3.x Retries 🔍 CI Insights 📄 Logs
Fast DDS MacOS CI mac-ci / fastdds_test () Unknown 0 View View
Fast DDS Ubuntu CI ubuntu-ci / fastdds_test (RelWithDebInfo) Unknown 0 View View
Fast DDS Windows CI windows-ci / fastdds_test (RelWithDebInfo, examples), v143 Unknown 0 View View

Copy link
Copy Markdown
Contributor

@juanlofer-eprosima juanlofer-eprosima left a comment

Choose a reason for hiding this comment

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

LGTM

@juanlofer-eprosima juanlofer-eprosima merged commit 4c4557f into 3.3.x Oct 13, 2025
43 of 52 checks passed
@juanlofer-eprosima juanlofer-eprosima deleted the mergify/bp/3.3.x/pr-6066 branch October 13, 2025 05:26
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.

1 participant