[PR #276] [CLOSED] refactor(proxy): fix race conditions with atomic types #1622

Closed
opened 2026-04-24 20:09:30 -05:00 by GiteaMirror · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/fosrl/newt/pull/276
Author: @LaurenceJJones
Created: 3/16/2026
Status: Closed

Base: devHead: refactor/proxy-fix-races


📝 Commits (4)

  • 8a62a4a refactor(proxy): fix race conditions with atomic types
  • bfeb87f refactor(proxy): capture tunnel ID per connection/flow to avoid misattribution
  • 0b31c78 fix: remove twice call
  • 9be76a3 Merge pull request #1 from LaurenceJJones/review/proxy-fix-races

📊 Changes

1 file changed (+56 additions, -29 deletions)

View changed files

📝 proxy/manager.go (+56 -29)

📄 Description

Community Contribution License Agreement

By creating this pull request, I grant the project maintainers an unlimited,
perpetual license to use, modify, and redistribute these contributions under any terms they
choose, including both the AGPLv3 and the Fossorial Commercial license terms. I
represent that I have the right to grant this license for all contributed content.

Description

  • Change running from bool to atomic.Bool
  • Change currentTunnelID from string to atomic.Value
  • Add getTunnelID() helper for safe reads
  • Add setTunnelID() helper for safe writes
  • Add isRunning() helper for safe reads
  • Add setRunning() helper for safe writes
  • Update all usages to use the helper methods

This fixes potential race conditions where running and currentTunnelID were being read without holding the mutex in hot paths.

How to test?


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/fosrl/newt/pull/276 **Author:** [@LaurenceJJones](https://github.com/LaurenceJJones) **Created:** 3/16/2026 **Status:** ❌ Closed **Base:** `dev` ← **Head:** `refactor/proxy-fix-races` --- ### 📝 Commits (4) - [`8a62a4a`](https://github.com/fosrl/newt/commit/8a62a4aae85469f2d9987f6663f34414e1915ae5) refactor(proxy): fix race conditions with atomic types - [`bfeb87f`](https://github.com/fosrl/newt/commit/bfeb87fed10040512b974327cbf35e94728e46b4) refactor(proxy): capture tunnel ID per connection/flow to avoid misattribution - [`0b31c78`](https://github.com/fosrl/newt/commit/0b31c7837bb1f95f14f9e71e2566594e38619544) fix: remove twice call - [`9be76a3`](https://github.com/fosrl/newt/commit/9be76a320fe6aa9a5eb29f374aae7393d0a0eb7d) Merge pull request #1 from LaurenceJJones/review/proxy-fix-races ### 📊 Changes **1 file changed** (+56 additions, -29 deletions) <details> <summary>View changed files</summary> 📝 `proxy/manager.go` (+56 -29) </details> ### 📄 Description ## Community Contribution License Agreement By creating this pull request, I grant the project maintainers an unlimited, perpetual license to use, modify, and redistribute these contributions under any terms they choose, including both the AGPLv3 and the Fossorial Commercial license terms. I represent that I have the right to grant this license for all contributed content. ## Description - Change running from bool to atomic.Bool - Change currentTunnelID from string to atomic.Value - Add getTunnelID() helper for safe reads - Add setTunnelID() helper for safe writes - Add isRunning() helper for safe reads - Add setRunning() helper for safe writes - Update all usages to use the helper methods This fixes potential race conditions where running and currentTunnelID were being read without holding the mutex in hot paths. ## How to test? --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
GiteaMirror added the pull-request label 2026-04-24 20:09:30 -05:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github-starred/newt#1622