This repository was archived by the owner on Nov 24, 2025. It is now read-only.

Description
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()