-
Notifications
You must be signed in to change notification settings - Fork 591
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Do DNS resolution before connection attempt #893
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
API approval tests also need updating. Run them with
dotnet test -f netcoreapp3.1 projects/Unit --filter "FullyQualifiedName~RabbitMQ.Client.Unit.APIApproval"
To see the diff:
diff projects/Unit/APIApproval.Approve.received.txt projects/Unit/APIApproval.Approve.verified.txt
or similar.
Just one thing I was wondering, is there a reason the RabbitMQ client doesn't just let the operating system decide if it should connect via IPv4 or IPv6 when it's given a hostname? |
Well most systems are dual stack now so the OS has the capabilities to connect using IPv6 and IPv4. However when someone sets up a server they will still only configure IPv4 entries in the DNS. The OS has no way of knowing what DNS entries there will be until it resolves the hostname. And even then the server can be up on IPv4 and not on IPv6 or vice versa, which the OS can also not know. |
@stebet unfortunately, the client cannot know what address family should be used or preferred. Local OS cannot know that either since target nodes can be configured to only listen for connections that use IPv6. Trying both families is the best default behavior. |
This changes an interface so can only go into |
Proposed Changes
When starting an application (with all exceptions on) rabbitmq always gives a couple of exceptions because it first tries to connect to IPv6 (and fails) but then succeeds to connect to IPv4. RabbitMQ is using exceptions as normal control flow. This is annoying. It makes the user wonder what he did wrong, and has to wressle through the startup of his program clicking away all the exceptions. Usually one will disable the recurring exceptions at the risk of missing it when it's relevant.
As asked in https://groups.google.com/g/rabbitmq-users/c/sHeiZMBwfWU
Also see https://stackoverflow.com/a/86395708/1560347 .
Types of Changes
What types of changes does your code introduce to this project?
Put an
x
in the boxes that applyChecklist
Put an
x
in the boxes that apply. You can also fill these out after creatingthe PR. If you're unsure about any of them, don't hesitate to ask on the
mailing list. We're here to help! This is simply a reminder of what we are
going to look for before merging your code.
CONTRIBUTING.md
documentFurther Comments
This pull request probably need some work. This is more of a proof of concept, please let me know what you think.
It's probably a big no-no to change the api, however it's impossible to pass an endpoint without doing the DNS resolution internally.