[PR #3342] [MERGED] Loop on failure of compare_exchange_weak #3760

Closed
opened 2026-03-16 12:01:18 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/hickory-dns/hickory-dns/pull/3342
Author: @divergentdave
Created: 11/4/2025
Status: Merged
Merged: 11/4/2025
Merged by: @divergentdave

Base: mainHead: david/compare-exchange-weak-loop


📝 Commits (1)

  • a190010 Loop on failure of compare_exchange_weak

📊 Changes

1 file changed (+15 additions, -9 deletions)

View changed files

📝 crates/resolver/src/name_server.rs (+15 -9)

📄 Description

NameServer::probe_encrypted_transport() currently skips probing if the budget is exhausted or if it encounters a failure when trying to update the budget. It does so using compare_exchange_weak(), which may spuriously fail on some platforms, even if the budget value is equal to the last budget value we read. This PR adds a loop to retry the compare and exchange, on both spurious failures and failed comparisons.


🔄 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/hickory-dns/hickory-dns/pull/3342 **Author:** [@divergentdave](https://github.com/divergentdave) **Created:** 11/4/2025 **Status:** ✅ Merged **Merged:** 11/4/2025 **Merged by:** [@divergentdave](https://github.com/divergentdave) **Base:** `main` ← **Head:** `david/compare-exchange-weak-loop` --- ### 📝 Commits (1) - [`a190010`](https://github.com/hickory-dns/hickory-dns/commit/a190010bbaeabb8c6582afbcfd6f3138b3eed629) Loop on failure of compare_exchange_weak ### 📊 Changes **1 file changed** (+15 additions, -9 deletions) <details> <summary>View changed files</summary> 📝 `crates/resolver/src/name_server.rs` (+15 -9) </details> ### 📄 Description `NameServer::probe_encrypted_transport()` currently skips probing if the budget is exhausted or if it encounters a failure when trying to update the budget. It does so using `compare_exchange_weak()`, which may spuriously fail on some platforms, even if the budget value is equal to the last budget value we read. This PR adds a loop to retry the compare and exchange, on both spurious failures and failed comparisons. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-16 12:01:18 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/hickory-dns#3760
No description provided.