Skip to content

fix(test): close TSAN race in WaitForSocketFile helper - #331

Open
pypingou wants to merge 1 commit into
eclipse-score:mainfrom
pypingou:fix/tsan-unix-domain-server-race
Open

pypingou wants to merge 1 commit into
eclipse-score:mainfrom
pypingou:fix/tsan-unix-domain-server-race

Conversation

@pypingou

Copy link
Copy Markdown
Contributor

WaitForSocketFile() used stat() to detect when the server's socket file appeared, but that only proves bind() completed — not listen(). Under TSAN instrumentation the window between bind() and listen() widens enough for the subsequent connect() in the test to hit ECONNREFUSED.

Replace the stat()-based check with an actual connect() probe that retries until the server is accepting connections, closing the race.

The probe connection is immediately closed without sending data, so the server treats it as a closed-by-peer with no session — no factory calls or session counters are affected.

See: https://github.com/eclipse-score/logging/actions/runs/35837155339/job/107103240555 for a example where this race condition happened.

Notes for Reviewer

Pre-Review Checklist for the PR Author

  • PR title is short, expressive and meaningful
  • Commits are properly organized
  • Relevant issues are linked in the References section
  • Tests are conducted
  • Unit tests are added

Checklist for the PR Reviewer

  • Commits are properly organized and messages are according to the guideline
  • Unit tests have been written for new behavior
  • Public API is documented
  • PR title describes the changes

Post-review Checklist for the PR Author

  • All open points are addressed and tracked via issues

References

Closes #

WaitForSocketFile() used stat() to detect when the server's socket file
appeared, but that only proves bind() completed — not listen(). Under
TSAN instrumentation the window between bind() and listen() widens
enough for the subsequent connect() in the test to hit ECONNREFUSED.

Replace the stat()-based check with an actual connect() probe that
retries until the server is accepting connections, closing the race.

The probe connection is immediately closed without sending data, so the
server treats it as a closed-by-peer with no session — no factory calls
or session counters are affected.

See: https://github.com/eclipse-score/logging/actions/runs/35837155339/job/107103240555
for a example where this race condition happened.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@github-actions

Copy link
Copy Markdown

License Check Results

🚀 The license check job ran with the Bazel command:

bazel run --lockfile_mode=error //:license-check

Status: ⚠️ Needs Review

Click to expand output
[License Check Output]
Extracting Bazel installation...
Starting local Bazel server (8.6.0) and connecting to it...
INFO: Invocation ID: 80e60f87-1e90-4354-8b38-19d1502264e7
Computing main repo mapping: 
Computing main repo mapping: 
WARNING: For repository 'rules_rust', the root module requires module version rules_rust@0.68.1-score, but got rules_rust@0.68.2-score in the resolved dependency graph. Please update the version in your MODULE.bazel or set --check_direct_dependencies=off
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Loading: 
Loading: 4 packages loaded
Loading: 4 packages loaded
    currently loading: 
WARNING: Target pattern parsing failed.
ERROR: Skipping '//:license-check': no such target '//:license-check': target 'license-check' not declared in package '' defined by /home/runner/work/logging/logging/BUILD
ERROR: no such target '//:license-check': target 'license-check' not declared in package '' defined by /home/runner/work/logging/logging/BUILD
INFO: Elapsed time: 16.735s
INFO: 0 processes.
ERROR: Build did NOT complete successfully
ERROR: Build failed. Not running target

This branch is waiting to be deployed

1 waiting deployment
workflow-approval 8e0ed5d9 Waiting Sep 23, 2026 by pypingou via qnx-build (x86_64-qnx) / approval #1077
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

1 participant