fix mongo transient tls error#4569
Merged
Merged
Conversation
pfcoperez
reviewed
Jul 13, 2026
|
|
||
| // TLS handshake failures during connection checkout is typically retryable. We've observed | ||
| // Atlas briefly serving a mismatched cert/key pair during rolling cert rotation that auto-recovers | ||
| if strings.Contains(err.Error(), MongoTLSInvalidServerCertSignature) { |
Member
There was a problem hiding this comment.
When matching errors by their message string we accept the risk of these messages changing in the most subtle ways, one extra space, or semicolon...
Do you think it would be worth of matching by parts of the message that we bet to be fairly constant? Something like:
Suggested change
| if strings.Contains(err.Error(), MongoTLSInvalidServerCertSignature) { | |
| func mongoTLSInvalidServerCertSignature(err error) bool { | |
| signatureParts := []string{ | |
| "tls", | |
| "invalid signature", | |
| "server certificate", | |
| } | |
| msg := err.Error() | |
| for _, chunk := range signatureParts { | |
| if !strings.Contains(msg, chunk) { | |
| return false | |
| } | |
| } | |
| return true | |
| } | |
| if mongoTLSInvalidServerCertSignature(err.Error) | |
| { |
Contributor
Author
There was a problem hiding this comment.
I'm inclined to keep it as is, the string is not coming from mongo source but is coming from go standard lib (ref), which tend to be more stable. And in the case where the string changes, the blast radius is small (e.g. we get notified). So inclined to use the full string matching pattern here for consistency and searchability.
ilidemi
approved these changes
Jul 14, 2026
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.
Mongo Atlas automatically manages TLS cert rotation ref. Classify this error as retryable.
Fixes: DBI-874