[PR #3818] [MERGED] [client] Feature/lazy manageable feature by mgm server #21602

Open
opened 2026-08-05 05:08:42 -04:00 by saavagebueno · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/3818
Author: @pappz
Created: 5/13/2025
Status: Merged
Merged: 5/15/2025
Merged by: @pappz

Base: feature/lazy-connectionHead: feature/lazy-connection-add-featureflag


📝 Commits (7)

📊 Changes

5 files changed (+427 additions, -325 deletions)

View changed files

📝 client/internal/conn_mgr.go (+105 -43)
📝 client/internal/engine.go (+5 -1)
📝 client/internal/lazyconn/manager/manager.go (+31 -8)
📝 management/proto/management.pb.go (+284 -273)
📝 management/proto/management.proto (+2 -0)

📄 Description

Describe your changes

Add an option to the management proto to enable or disable the lazy connection feature on the peer side. Command-line options and environment variables override the management configuration.

  • When the feature is enabled: Start the lazy connection manager and add all peers to the manager in the "active" st-ate.

  • When the feature is disabled: Stop the lazy connection manager and establish connections to all peers in the store.

Fix deadlock

The conn_mgr is protected by a mutex. However, because some internal functions are called via callbacks from the lazy connection manager, a deadlock can occur. The solution is to completely eliminate the callbacks.

Stack

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/3818 **Author:** [@pappz](https://github.com/pappz) **Created:** 5/13/2025 **Status:** ✅ Merged **Merged:** 5/15/2025 **Merged by:** [@pappz](https://github.com/pappz) **Base:** `feature/lazy-connection` ← **Head:** `feature/lazy-connection-add-featureflag` --- ### 📝 Commits (7) - [`4054e4b`](https://github.com/netbirdio/netbird/commit/4054e4b589b87e62becbefe931b41c568906e8e7) Add lazy conn feature flag for mgm - [`873dbdb`](https://github.com/netbirdio/netbird/commit/873dbdb192e60ce794e75709f215e5e79376a618) Start to use update feature function - [`a6e4093`](https://github.com/netbirdio/netbird/commit/a6e4093079cfd8029562c05a86666f03f2d168e8) Code cleaning - [`3e24f3a`](https://github.com/netbirdio/netbird/commit/3e24f3a703c56b37cf7e9357990a46640f00a91d) Add log - [`848eb7b`](https://github.com/netbirdio/netbird/commit/848eb7b2cc3bec41ad05395ca3d19288b89a6ade) Fix to use proper context - [`39c18d5`](https://github.com/netbirdio/netbird/commit/39c18d57fbfe4ee072fd246525776779cf612f17) Add comments - [`8ee5987`](https://github.com/netbirdio/netbird/commit/8ee59873fa6317d99a8d7b8d32b043f32030438d) Fix deadlock ### 📊 Changes **5 files changed** (+427 additions, -325 deletions) <details> <summary>View changed files</summary> 📝 `client/internal/conn_mgr.go` (+105 -43) 📝 `client/internal/engine.go` (+5 -1) 📝 `client/internal/lazyconn/manager/manager.go` (+31 -8) 📝 `management/proto/management.pb.go` (+284 -273) 📝 `management/proto/management.proto` (+2 -0) </details> ### 📄 Description ## Describe your changes Add an option to the management proto to enable or disable the lazy connection feature on the peer side. Command-line options and environment variables override the management configuration. - When the feature is enabled: Start the lazy connection manager and add all peers to the manager in the "active" st-ate. - When the feature is disabled: Stop the lazy connection manager and establish connections to all peers in the store. Fix deadlock The conn_mgr is protected by a mutex. However, because some internal functions are called via callbacks from the lazy connection manager, a deadlock can occur. The solution is to completely eliminate the callbacks. ## Issue ticket number and link ## Stack <!-- branch-stack --> ### Checklist - [ ] Is it a bug fix - [ ] Is a typo/documentation fix - [x] 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 05:08:42 -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#21602