-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
grpc.FailOnNonTempDialError
doesn't fail with wrong TLS certificate
#6593
Comments
If needed, I could also try to prepare a code/repo that shows the issue, or I could also try to write a test, but I am not sure about the time frame of it since I am not familiar with the grpc-go code base. |
My guess is that this is working as intended: |
I assume that it shouldn't wait for the context since we also use the Actually, the code is trying to check and exit earlier: Lines 285 to 294 in aa6ce35
But the issue is that the error is wrapped without paying attention to the fact that it's a permanent one (obviously, we can't change the wrong certificate on the fly) and treated as temporary (see a screenshot of my debugger from above). For reference, the |
Ha, I didn't realize you are also using |
Right, it could be a lousy naming of the issue. I'll try to adjust it. Yeah, I see that the Also, the suggested fix works for me. At least I've done some testing after applying it to our codebase and successfully passed the grpc-go tests. |
grpc.FailOnNonTempDialError
doesn't work with wrong TLS certificate
grpc.FailOnNonTempDialError
doesn't work with wrong TLS certificategrpc.FailOnNonTempDialError
doesn't fail with wrong TLS certificate
With help from the community, we put together this doc about anti-patterns: https://github.com/grpc/grpc-go/blob/master/Documentation/anti-patterns.md. Is not using the three dial options And if you don't use them and instead rely on errors at RPC time, do you see the error that you expect? |
Hi, @easwars! Thank you for getting back to me. Yes, I saw the https://github.com/grpc/grpc-go/blob/master/Documentation/anti-patterns.md and found using these gRPC options is anti-pattern. I've started thinking about how we can re-design our API in the sense that it avoids using this anti-pattern, but unfortunately, the migration could take some time. But I could see the case where As I commented, I'm happy to open PR with the fix, but I need more time to get familiar with the codebase to write the proper test (right now, all tests are passing with and without the fix). But on the other side, I don't know what's your vision around the |
@olegbespalov : We currently don't have any plans of marking
Would it be possible for you to setup a repro or a test for this issue? That would be great. I think I buy your argument that calls to If you have a PR with test(s), feel free to send that over as well. Thanks for reporting this issue. |
This issue is labeled as requiring an update from the reporter, and no update has been received after 6 days. If no update is provided in the next 7 days, this issue will be automatically closed. |
This issue is labeled as requiring an update from the reporter, and no update has been received after 6 days. If no update is provided in the next 7 days, this issue will be automatically closed. |
What version of gRPC are you using?
What version of Go are you using (
go version
)?What operating system (Linux, Windows, …) and version?
What did you do?
So we have a code dependent on the grpc library, and we were trying to establish a connection by using the:
where
options
looks like:Some of our tests intentionally used the wrong TLS certificate.
What did you expect to see?
So I expected to see the error about the
bad certificate
almost immediately.What did you see instead?
But instead, I found that we were waiting till the context to reach the deadline, and only after that could I get the error.
I started to investigate, and it turned out that the error of a bad certificate is treated as a temporary error, which means that the transport will try to do some retries on that.
Looking into the code, I see that the place
grpc-go/internal/transport/http2_client.go
Line 1566 in 9362f26
doesn't use the helper
isTemporary
, but instead passes the statictrue
to theconnectionError
's constructor.So I believe the fix is pretty straightforward like:
The text was updated successfully, but these errors were encountered: