Skip to content

Reconnect to the last endpoint without restarting tasks - #1220

Open
steils wants to merge 1 commit into
eclipse-zenoh:mainfrom
ZettaScaleLabs:reconnection
Open

Reconnect to the last endpoint without restarting tasks#1220
steils wants to merge 1 commit into
eclipse-zenoh:mainfrom
ZettaScaleLabs:reconnection

Conversation

@steils

@steils steils commented May 12, 2026

Copy link
Copy Markdown
Member

Avoid restarting transport tasks during client reconnect.
Reuse the existing client transport and try the last successful endpoint first.
If that fails, continue with the configured connect locators or scouted locators. Restore the connection without replacing the transport object.

Closes: #1005
Closes: #1053


🏷️ Label-Based Checklist

Based on the labels applied to this PR, please complete these additional requirements:

Labels: enhancement

✨ Enhancement Requirements

Since this PR enhances existing functionality:

  • Enhancement scope documented - Clear description of what is being improved
  • Minimum necessary code - Implementation is as simple as possible, doesn't overcomplicate the system
  • Backwards compatible - Existing code/APIs still work unchanged
  • No new APIs added - Only improving existing functionality
  • Tests updated - Existing tests pass, new test cases added if needed
  • Performance improvement measured - If applicable, before/after metrics provided
  • Documentation updated - Existing docs updated to reflect improvements
  • User impact documented - How users benefit from this enhancement

Remember: Enhancements should not introduce new APIs or breaking changes.

Instructions:

  1. Check off items as you complete them (change - [ ] to - [x])
  2. The PR checklist CI will verify these are completed

This checklist updates automatically when labels change, but preserves your checked boxes.

LIVELINESS_SUB_CLIENT_COMMAND = STDBUF_CMD + [f'{DIR_EXAMPLES}/z_sub_liveliness', '-h', '-e', f'tcp/127.0.0.1:{ZENOH_PORT}']

SINGLE_THREAD_ZENOH_PORT = "7448"
SINGLE_THREAD_ROUTER_ARGS = ['-l', f'tcp/0.0.0.0:{SINGLE_THREAD_ZENOH_PORT}', '--no-multicast-scouting']

@github-advanced-security github-advanced-security AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Cppcheck (reported by Codacy) found more than 20 potential problems in the proposed changes. Check the Files changed tab for more details.

@steils steils changed the title Improve reconnection mechanism to try first reconnect latest endpoint without thread restart Reconnect to the latest endpoint without restarting tasks May 12, 2026
@steils steils changed the title Reconnect to the latest endpoint without restarting tasks Reconnect to the last endpoint without restarting tasks May 12, 2026
@steils steils added the enhancement Existing things could work better label May 12, 2026
Comment thread tests/single_thread.py Fixed
@steils
steils force-pushed the reconnection branch 2 times, most recently from 631df0d to 3da94d4 Compare May 13, 2026 15:30
@steils
steils marked this pull request as ready for review May 13, 2026 16:05
Comment thread .github/workflows/ci.yml Outdated
Comment thread .github/workflows/ci.yml Outdated
Comment thread tests/single_thread.py Outdated
Comment thread src/transport/transport.c Outdated
Comment thread src/transport/transport.c Outdated
Comment thread src/transport/transport.c Outdated
Comment thread src/transport/transport.c Outdated
Comment thread src/net/session.c Outdated
Comment thread src/net/session.c Outdated
@Vuk-SFL

Vuk-SFL commented May 15, 2026

Copy link
Copy Markdown
Contributor

Does this change make #1205 unnecessary since that PR is about adressing tx resource usage while reconenction is active?

@steils
steils marked this pull request as draft May 15, 2026 20:32
@steils

steils commented May 19, 2026

Copy link
Copy Markdown
Member Author

@Vuk-SFL

Does this change make #1205 unnecessary since that PR is about adressing tx resource usage while reconenction is active?

For the reconnect case is covered in this PR, I think yes, it's no longer needed. But as I see #1205 touches more general clear paths, so that still should be relevant after this PR.

@steils
steils marked this pull request as ready for review May 19, 2026 02:08
@steils
steils requested a review from gmartin82 May 19, 2026 02:08
Comment thread src/net/session.c Outdated
Comment thread src/net/session.c
Comment thread src/net/session.c
Comment thread src/net/session.c Outdated
Comment thread src/net/session.c Outdated
Comment thread src/net/session.c Outdated
Comment thread src/net/session.c Outdated
Comment thread src/net/session.c Outdated
Comment thread src/net/session.c Outdated
Comment thread src/net/session.c Outdated
@steils
steils marked this pull request as draft May 20, 2026 12:44
@steils
steils force-pushed the reconnection branch 4 times, most recently from c7ca57b to 99ba7d1 Compare May 25, 2026 04:40
Avoid restarting transport tasks during client reconnect.
Reuse the existing client transport and try the last successful endpoint
first.
If that fails, continue with the configured connect locators or scouted
locators. Restore the connection without replacing the transport object.

Closes: eclipse-zenoh#1005
Closes: eclipse-zenoh#1053
@steils
steils marked this pull request as ready for review May 25, 2026 05:56
@steils
steils requested a review from gmartin82 May 25, 2026 05:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement Existing things could work better

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Reconnection on ThreadX causes crash due to memset() The rmw_zenoh on Arduino on ESP32 in unicast of client mode does not reconnect

4 participants