Skip to content

AutoRenew of Lets Encrypt SSLs fails #8116

@Vijay-1

Description

@Vijay-1

Defect

Autorenew of Lets Encrypt fails.

Components

Traffic Ops

What did you do?

Autorenew Lets encrypt

What did you expect to happen?

Autorenewal of SSL Certs for all the relevants Delivery Services

What actually happened?

It failed with the following error

ERROR: autorenewcerts.go:186: 2024-06-24T17:48:51.293939Z: getting ssl keys for xmlId: dummy1 and version: 2 : could not begin Traffic Vault PostgreSQL transaction: context canceled: context canceled
ERROR: autorenewcerts.go:186: 2024-06-24T17:48:51.293978895Z: getting ssl keys for xmlId: dummy1 and version: 2 : could not begin Traffic Vault PostgreSQL transaction: context canceled: context canceled

Root Cause

Looks like this is because the Request handler renewCertificates does autorenew via goroutine with its context which gets cancelled once it returns.

Potential Fix

The following change appear to be working

Pass in db to RunAutorenewal from renewCertificates and in RunAutorenewal do the following

+       ctx, cancelCtx := context.WithTimeout(context.Background(), AcmeTimeout*time.Duration((totCerts)))
+       ctx = context.WithValue(ctx, api.DBContextKey, db)
+       defer cancelCtx()

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsomething isn't working as intended

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions