Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions bazel/c-ares.patch
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,21 @@ index eabd17fc..83bcf06f 100644
if (file_lookup(hquery) == ARES_SUCCESS) {
end_hquery(hquery, ARES_SUCCESS);

# Fix reentrant query removal after QID reuse (c-ares PR #1256)
diff --git a/src/lib/ares_process.c b/src/lib/ares_process.c
--- a/src/lib/ares_process.c
+++ b/src/lib/ares_process.c
@@ -1601,7 +1601,12 @@ static void ares_detach_query(ares_query_t *query)
{
/* Remove the query from all the lists in which it is linked */
ares_query_remove_from_conn(query);
- ares_htable_szvp_remove(query->channel->queries_by_qid, query->qid);
+ /* A callback may queue a new query that reuses this ID. Only remove the
+ * entry if it still points to this query. */
+ if (ares_htable_szvp_get_direct(query->channel->queries_by_qid, query->qid) ==
+ query) {
+ ares_htable_szvp_remove(query->channel->queries_by_qid, query->qid);
+ }
ares_llist_node_destroy(query->node_all_queries);
query->node_all_queries = NULL;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Fixed the c-ares resolver to preserve a reentrant query when it reuses the completing query's DNS transaction ID. Previously, the old query could remove the new query's ID mapping and permanently stall DNS refresh for the affected cluster.
Loading