[PR #4974] [ios] iOS client start hanging on reconnection #21724

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

📋 Pull Request Information

Original PR: https://github.com/netbirdio/netbird/pull/4974
Author: @doromaraujo
Created: 12/19/2025
Status: 🔄 Open

Base: mainHead: bug/ios-hanging-reconection


📝 Commits (6)

  • 72e1fe7 Add extra logs to engine and dns manager
  • 0e9cddf Execute PopulateNetbirdConfig in a go routine
  • 5a91664 Improve PopulateNetbirdConfig goroutine with retry logic
  • ee9166d Remove outdated success log message
  • 76c63d0 Track PopulateNetbirdConfig goroutine with e.shutdownWg
  • 691a905 Change log.Debug in goroutine for log.Info

📊 Changes

2 files changed (+77 additions, -3 deletions)

View changed files

📝 client/internal/dns/mgmt/mgmt.go (+5 -0)
📝 client/internal/engine.go (+72 -3)

📄 Description

Describe your changes

This PR adds executes the PopulateNetbirdConfig() call in engine's Start() in a go routine with retrying mechanism.

It also adds breadcrumb logs along Start()'s function calls.

Reasoning for it is that Go’s DNS lookups on macOS/iOS can hang when a network change interferes with the system resolver’s operation.

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)

By submitting this pull request, you confirm that you have read and agree to the terms of the Contributor License Agreement.

Documentation

Select exactly one:

  • I added/updated documentation for this change
  • Documentation is not needed for this change (explain why)

Docs PR URL (required if "docs added" is checked)

Paste the PR link from https://github.com/netbirdio/docs here:

https://github.com/netbirdio/docs/pull/__

Summary by CodeRabbit

  • Bug Fixes

    • Improved DNS cache population reliability with automatic retries (exponential backoff and jitter) and cancellation support to reduce startup failures.
  • Chores

    • Enhanced observability with expanded runtime logging across startup and configuration flows for better traceability and debugging.

✏️ Tip: You can customize this high-level summary in your review settings.


🔄 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/4974 **Author:** [@doromaraujo](https://github.com/doromaraujo) **Created:** 12/19/2025 **Status:** 🔄 Open **Base:** `main` ← **Head:** `bug/ios-hanging-reconection` --- ### 📝 Commits (6) - [`72e1fe7`](https://github.com/netbirdio/netbird/commit/72e1fe7b483442428fd4baaa3aaf624db5f397e8) Add extra logs to engine and dns manager - [`0e9cddf`](https://github.com/netbirdio/netbird/commit/0e9cddf2e878edbe1bd1f68e2ff0673ae4d008ed) Execute PopulateNetbirdConfig in a go routine - [`5a91664`](https://github.com/netbirdio/netbird/commit/5a916641160d77e053de806d64330777d5f5f714) Improve PopulateNetbirdConfig goroutine with retry logic - [`ee9166d`](https://github.com/netbirdio/netbird/commit/ee9166d771f5e86c634e3ad8b22e6e4bcd1e8709) Remove outdated success log message - [`76c63d0`](https://github.com/netbirdio/netbird/commit/76c63d0dd26a777f6b3be5e684a15c7a05b84f6d) Track PopulateNetbirdConfig goroutine with e.shutdownWg - [`691a905`](https://github.com/netbirdio/netbird/commit/691a90516df4dc029a00a61f0d60dbefda708c40) Change log.Debug in goroutine for log.Info ### 📊 Changes **2 files changed** (+77 additions, -3 deletions) <details> <summary>View changed files</summary> 📝 `client/internal/dns/mgmt/mgmt.go` (+5 -0) 📝 `client/internal/engine.go` (+72 -3) </details> ### 📄 Description ## Describe your changes This PR adds executes the PopulateNetbirdConfig() call in engine's Start() in a go routine with retrying mechanism. It also adds breadcrumb logs along Start()'s function calls. Reasoning for it is that Go’s DNS lookups on macOS/iOS can hang when a network change interferes with the system resolver’s operation. ## Issue ticket number and link ## Stack <!-- branch-stack --> ### 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) > By submitting this pull request, you confirm that you have read and agree to the terms of the [Contributor License Agreement](https://github.com/netbirdio/netbird/blob/main/CONTRIBUTOR_LICENSE_AGREEMENT.md). ## Documentation Select exactly one: - [ ] I added/updated documentation for this change - [X] Documentation is **not needed** for this change (explain why) ### Docs PR URL (required if "docs added" is checked) Paste the PR link from https://github.com/netbirdio/docs here: https://github.com/netbirdio/docs/pull/__ <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **Bug Fixes** * Improved DNS cache population reliability with automatic retries (exponential backoff and jitter) and cancellation support to reduce startup failures. * **Chores** * Enhanced observability with expanded runtime logging across startup and configuration flows for better traceability and debugging. <sub>✏️ Tip: You can customize this high-level summary in your review settings.</sub> <!-- end of auto-generated comment: release notes by coderabbit.ai --> --- <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:52 -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#21724