Skip to content

win32: keep a winsock instance alive during tests to fix spurious CI failures#892

Open
jcelerier wants to merge 1 commit into
masterfrom
claude/upbeat-brahmagupta-xhgc2a
Open

win32: keep a winsock instance alive during tests to fix spurious CI failures#892
jcelerier wants to merge 1 commit into
masterfrom
claude/upbeat-brahmagupta-xhgc2a

Conversation

@jcelerier

Copy link
Copy Markdown
Member

Summary

Restores the lost fix (originally e5ea48d) for the spurious Win32 CI test failures caused by WinSock being torn down between operations.

asio refcounts WSAStartup/WSACleanup per object, so during the test run WinSock can be cleaned up between operations, producing intermittent socket failures on the Win32 runners (e.g. https://github.com/ossia/libossia/actions/runs/27264509297/job/80518258354).

The fix keeps a WinSock instance alive for the whole lifetime of the test process via a static owner struct in the shared Catch test header (tests/catch/include_catch.hpp), which every test pulls in. Library code is unchanged.

#if defined(_WIN32)
#include <winsock2.h>
static const struct ossia_test_winsock_owner {
  ossia_test_winsock_owner() { WSADATA d; ::WSAStartup(MAKEWORD(2, 2), &d); }
  ~ossia_test_winsock_owner() { ::WSACleanup(); }
} ossia_test_winsock_owner_instance;
#endif

Test plan

  • Win32 test jobs stay green across repeated CI runs (the failures were intermittent).

https://claude.ai/code/session_01XRmDZYxYXvYGHnnAVQ3j9T


Generated by Claude Code

Restore the lost fix (originally e5ea48d) for the spurious Win32 CI test
failures: keep a WinSock instance alive for the whole lifetime of the test
process via a static owner struct in the shared Catch test header.
@jcelerier jcelerier temporarily deployed to Apple Certificate June 10, 2026 22:57 — with GitHub Actions Inactive
@jcelerier jcelerier temporarily deployed to Apple Certificate June 10, 2026 22:57 — with GitHub Actions Inactive
@jcelerier jcelerier temporarily deployed to Apple Certificate June 10, 2026 22:57 — with GitHub Actions Inactive
@jcelerier jcelerier temporarily deployed to Apple Certificate June 10, 2026 22:57 — with GitHub Actions Inactive
@jcelerier jcelerier temporarily deployed to Apple Certificate June 10, 2026 22:57 — with GitHub Actions Inactive
@jcelerier jcelerier temporarily deployed to Apple Certificate June 10, 2026 22:57 — with GitHub Actions Inactive
@jcelerier jcelerier temporarily deployed to Apple Certificate June 10, 2026 22:57 — with GitHub Actions Inactive
@jcelerier jcelerier temporarily deployed to Apple Certificate June 10, 2026 22:57 — with GitHub Actions Inactive
@jcelerier jcelerier temporarily deployed to Apple Certificate June 10, 2026 22:57 — with GitHub Actions Inactive
@jcelerier jcelerier temporarily deployed to Apple Certificate June 10, 2026 22:57 — with GitHub Actions Inactive
@jcelerier jcelerier deployed to Apple Certificate June 10, 2026 22:57 — with GitHub Actions Active
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.

2 participants