Skip to content

fix(telemetry): make the launch-source once-guard goroutine-safe - #992

Merged
github-actions[bot] merged 1 commit into
mainfrom
fix/991-launch-source-race
Aug 14, 2026
Merged

fix(telemetry): make the launch-source once-guard goroutine-safe#992
github-actions[bot] merged 1 commit into
mainfrom
fix/991-launch-source-race

Conversation

@Dumbris

@Dumbris Dumbris commented Aug 14, 2026

Copy link
Copy Markdown
Member

Fixes #991

launchSourceOnceT was a bare done bool with no synchronization — concurrent DetectLaunchSourceOnce() calls (two listeners' /api/v1/status handlers in practice) raced on both the flag and launchSourceCached. The guard now holds a mutex (Do exclusive; cached write ordered before any post-Do read), and resetLaunchSourceOnce resets under the same lock instead of copying the struct.

Testing

  • New TestDetectLaunchSourceOnceConcurrent (32 goroutines) — reproduces the DATA RACE before the fix, green after
  • Original repro green: go test -race ./internal/server -run TestE2E_DualListener_Concurrent
  • lint v2 (CI config) 0 issues

Fixes #991

launchSourceOnceT was a bare done bool with no synchronization; concurrent
DetectLaunchSourceOnce calls (two listeners' /api/v1/status handlers in
practice) raced on the flag and the cached value. The guard now holds a
mutex — Do is exclusive and the cached write is ordered before any post-Do
read — and resetLaunchSourceOnce resets under the same lock instead of
copying the struct.

## Testing
- New TestDetectLaunchSourceOnceConcurrent (32 goroutines): DATA RACE
  before the fix, green after
- Original repro green: go test -race ./internal/server -run
  TestE2E_DualListener_Concurrent
- lint v2 0 issues
@cloudflare-workers-and-pages

Copy link
Copy Markdown

Deploying mcpproxy-docs with  Cloudflare Pages  Cloudflare Pages

Latest commit: d68817a
Status: ✅  Deploy successful!
Preview URL: https://4d7d0dc9.mcpproxy-docs.pages.dev
Branch Preview URL: https://fix-991-launch-source-race.mcpproxy-docs.pages.dev

View logs

@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@github-actions

Copy link
Copy Markdown

📦 Build Artifacts

Workflow Run: View Run
Branch: fix/991-launch-source-race

Available Artifacts

  • archive-darwin-amd64 (29 MB)
  • archive-darwin-arm64 (26 MB)
  • archive-linux-amd64 (17 MB)
  • archive-linux-arm64 (15 MB)
  • archive-windows-amd64 (28 MB)
  • archive-windows-arm64 (25 MB)
  • frontend-dist-pr (0 MB)
  • installer-dmg-darwin-amd64 (22 MB)
  • installer-dmg-darwin-arm64 (20 MB)

How to Download

Option 1: GitHub Web UI (easiest)

  1. Go to the workflow run page linked above
  2. Scroll to the bottom "Artifacts" section
  3. Click on the artifact you want to download

Option 2: GitHub CLI

gh run download 31828719168 --repo smart-mcp-proxy/mcpproxy-go

Note: Artifacts expire in 14 days.

@github-actions github-actions Bot 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.

Approved (Model B): Paperclip review verdicts = ACCEPT and qa-gate green at this head SHA. Arming auto-merge; GitHub merges when all required checks pass.

@github-actions
github-actions Bot merged commit 54931ba into main Aug 14, 2026
37 checks passed
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.

[Bug]: data race in telemetry launch_source (launchSourceOnceT.Do via handleGetStatus) under concurrent dual-listener requests

2 participants