Skip to content

tests: allow retries on transient bind errors (WSAEADDRNOTAVAIL, WSAEADDRINUSE) in socket_helper - #5515

Merged
Shankar Seal (shankarseal) merged 3 commits into
microsoft:mainfrom
adri22235:fix/socket-bind-ipv6-wsaeaddrnotavail
Sep 14, 2026
Merged

Shankar Seal (shankarseal) merged 3 commits into
microsoft:mainfrom
adri22235:fix/socket-bind-ipv6-wsaeaddrnotavail

Conversation

@adri22235

Copy link
Copy Markdown
Contributor

Description

In CI test runners (such as Windows Server 2025 virtual machine environments), IPv6 and Dual Stack local interface bindings can experience transient delays during socket initialization, returning WSAEADDRNOTAVAIL (10049) or WSAEADDRINUSE (10048).

Currently, _base_socket::_base_socket immediately invokes FAIL() on any error other than WSAENOBUFS, aborting on the very first attempt without utilizing the 5-iteration retry loop.

Fix:

  • Added is_transient_error helper in tests/libs/util/socket_helper.cpp to recognize WSAEADDRNOTAVAIL (10049) and WSAEADDRINUSE (10048) alongside WSAENOBUFS (10055).
  • Allows the retry loop with Sleep(1000) to retry binding during transient adapter readiness delays.

Testing

  • Formatted with Clang 19.1.7.
  • Verified logic in tests/libs/util/socket_helper.cpp.

@adri22235

Copy link
Copy Markdown
Contributor Author

@microsoft-github-policy-service agree

@github-actions

Copy link
Copy Markdown
Contributor

This pull request isn't linked to any GitHub issue. Please reference an issue with a keyword such as Fixes #123, Closes #456, etc., so the work can be tracked.

@github-actions

Copy link
Copy Markdown
Contributor

This pull request isn't linked to any GitHub issue. Please reference an issue with a keyword such as Fixes #123, Closes #456, etc., so the work can be tracked.

@github-actions

Copy link
Copy Markdown
Contributor

This pull request isn't linked to any GitHub issue. Please reference an issue with a keyword such as Fixes #123, Closes #456, etc., so the work can be tracked.

1 similar comment
@github-actions

Copy link
Copy Markdown
Contributor

This pull request isn't linked to any GitHub issue. Please reference an issue with a keyword such as Fixes #123, Closes #456, etc., so the work can be tracked.

}

if (expected_bind_error == 0 && !_bind_succeeded) {
FAIL("Failed to bind socket after retries with error: " << _actual_bind_error);

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.

FAIL

If I get it right, by default FAIL throws an exception. In this case dtor is not invoked and socket is getting leaked.

As issue exists in original code, consider this non-blocking. We may need to fix it later.

@maxsud Maksim S. (maxsud) 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.

:shipit:

@shankarseal
Shankar Seal (shankarseal) added this pull request to the merge queue Sep 14, 2026
Merged via the queue into microsoft:main with commit bbe30da Sep 14, 2026
160 of 179 checks passed
@github-project-automation github-project-automation Bot moved this from Todo to Done in eBPF for Windows Triage Sep 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

5 participants