[PR #2607] [MERGED] [client] Fix race condition while read/write conn status in peer conn #17818

Closed
opened 2026-08-05 04:07:46 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/2607
Author: @pappz
Created: 9/16/2024
Status: Merged
Merged: 9/17/2024
Merged by: @mlsmaycon

Base: mainHead: fix/status-race-condition


📝 Commits (2)

📊 Changes

3 files changed (+60 additions, -24 deletions)

View changed files

📝 client/internal/peer/conn.go (+20 -20)
📝 client/internal/peer/conn_status.go (+33 -2)
📝 client/internal/peer/conn_test.go (+7 -2)

📄 Description

Describe your changes

The ConnStatus variable has been read in internal/peer/conn.go:330 and has been written in internal/peer/conn.go:422. It was not thread safe.

Checklist

  • Is it a bug fix
  • Is a typo/documentation fix
  • Is a feature enhancement
  • It is a refactor
  • Created tests that fail without the change (if possible)
  • Extended the README / documentation, if necessary

🔄 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/netbirdio/netbird/pull/2607 **Author:** [@pappz](https://github.com/pappz) **Created:** 9/16/2024 **Status:** ✅ Merged **Merged:** 9/17/2024 **Merged by:** [@mlsmaycon](https://github.com/mlsmaycon) **Base:** `main` ← **Head:** `fix/status-race-condition` --- ### 📝 Commits (2) - [`05042c8`](https://github.com/netbirdio/netbird/commit/05042c89ee04fdc07131d9a93b57dc2d31950440) Fix race condition - [`dc8852f`](https://github.com/netbirdio/netbird/commit/dc8852f9056ca92879b51f9a9a245f9bd5f8b44d) Fix test ### 📊 Changes **3 files changed** (+60 additions, -24 deletions) <details> <summary>View changed files</summary> 📝 `client/internal/peer/conn.go` (+20 -20) 📝 `client/internal/peer/conn_status.go` (+33 -2) 📝 `client/internal/peer/conn_test.go` (+7 -2) </details> ### 📄 Description ## Describe your changes The ConnStatus variable has been read in internal/peer/conn.go:330 and has been written in internal/peer/conn.go:422. It was not thread safe. ## Issue ticket number and link ### Checklist - [x] Is it a bug fix - [ ] Is a typo/documentation fix - [ ] Is a feature enhancement - [ ] It is a refactor - [ ] Created tests that fail without the change (if possible) - [ ] Extended the README / documentation, if necessary --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
saavagebueno added the pull-request label 2026-08-05 04:07:46 -04:00
Sign in to join this conversation.
No Label pull-request
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: DYNR/netbird#17818