[c-ares DNS resolver] Revert "Revert "[c-ares DNS resolver] Fix file descriptor use-after-close bug when c-ares writes succeed but subsequent read fails" (#33934)"#33942
Merged
apolcyn merged 3 commits intogrpc:masterfrom Aug 1, 2023
Conversation
…lose bug when c-ares writes succeed but subsequent read fails" (grpc#33934)" This reverts commit 9aca06d.
yijiem
approved these changes
Aug 1, 2023
apolcyn
added a commit
that referenced
this pull request
Aug 30, 2023
…l has data left in its read buffer (#34185) If we get a readable event on an fd and both the following happens: - c-ares does *not* read all bytes off the fd - c-ares removes the fd from the set ARES_GETSOCK_READABLE ... then we have a busy loop here, where we'd keep asking c-ares to process an fd that it no longer cares about. This is indirectly related to a change in this code one month ago: #33942 - before that change, c-ares would close the socket when it called [handle_error](https://github.com/c-ares/c-ares/blob/7f3262312f246556d8c1bdd8ccc1844847f42787/src/lib/ares_process.c#L707) and so `IsFdStillReadableLocked` would start returning `false`, causing us to get away with [this loop](https://github.com/grpc/grpc/blob/f6a994229e72bc771963706de7a0cd8aa9150bb6/src/core/ext/filters/client_channel/resolver/dns/c_ares/grpc_ares_wrapper.cc#L371). Now, because `IsFdStillReadableLocked` will keep returning true (because of our overridden `close` API), we'll loop forever.
apolcyn
added a commit
that referenced
this pull request
Sep 18, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rolls forward #33871
Second and third commits here fix internal build issues
In particular, add a
// IWYU pragma: no_include <ares_build.h>sinceares.hincludes that anyways (and seems unlikely for that to change since it would be breaking)