Skip to content

Filter removed server addresses with OptionalTransport equality#4561

Open
pepone wants to merge 2 commits intoicerpc:mainfrom
pepone:fix/locator-retry-transport-equality
Open

Filter removed server addresses with OptionalTransport equality#4561
pepone wants to merge 2 commits intoicerpc:mainfrom
pepone:fix/locator-retry-transport-equality

Conversation

@pepone
Copy link
Copy Markdown
Member

@pepone pepone commented Apr 27, 2026

Fixes #4429

The locator filter at LocatorInterceptor.ComputeServerAddresses used
default ServerAddress equality on RemovedServerAddresses, which
requires an exact transport-string match. The connection layer
(ClientConnection / ConnectionCache) treats two server addresses as
the same physical endpoint when their Protocol/Host/Port/Params match
and at least one Transport is null (ServerAddressComparer.OptionalTransport).

This asymmetry let a replica that the retry interceptor previously
removed (e.g. ice://host:10000?transport=tcp) survive the filter when
the locator re-returned it without a transport (ice://host:10000).
The retry loop then re-targeted the same broken endpoint.

Build a HashSet keyed on OptionalTransport once and use it for both
the main and alt-server filters. Add a regression test covering the
explicit-transport / no-transport asymmetry.
Copilot AI review requested due to automatic review settings April 27, 2026 15:19
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This PR fixes a retry/locator filtering mismatch by ensuring removed server addresses are compared using the same equality semantics as the connection layer, preventing a just-failed replica from being reintroduced when re-resolved without an explicit transport.

Changes:

  • Update LocatorInterceptor.ComputeServerAddresses to filter removed addresses using ServerAddressComparer.OptionalTransport.
  • Apply the same comparer to both main and alt-server address filtering.
  • Add a regression test for the explicit-transport vs null-transport removed-address asymmetry.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
tests/IceRpc.Locator.Tests/LocatorInterceptorTests.cs Adds a regression test ensuring transport-normalized re-resolution doesn’t bypass removed-address filtering.
src/IceRpc.Locator/LocatorInterceptor.cs Uses ServerAddressComparer.OptionalTransport for removed-address filtering to align with connection-layer address identity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Audit-Medium] locator retry filtering can reintroduce a replica that…

2 participants