Skip to content

fix mongo transient tls error#4569

Merged
jgao54 merged 1 commit into
mainfrom
classify-mongo-tls-handleshake-err
Jul 15, 2026
Merged

fix mongo transient tls error#4569
jgao54 merged 1 commit into
mainfrom
classify-mongo-tls-handleshake-err

Conversation

@jgao54

@jgao54 jgao54 commented Jul 11, 2026

Copy link
Copy Markdown
Contributor

Mongo Atlas automatically manages TLS cert rotation ref. Classify this error as retryable.

Fixes: DBI-874

@jgao54
jgao54 requested a review from a team as a code owner July 11, 2026 00:28

// 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) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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)
{

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@jgao54
jgao54 merged commit d1eea4b into main Jul 15, 2026
23 checks passed
@jgao54
jgao54 deleted the classify-mongo-tls-handleshake-err branch July 15, 2026 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants