Vijay-1 opened a new issue, #8116:
URL: https://github.com/apache/trafficcontrol/issues/8116

   ### Defect
   Autorenew of Lets Encrypt fails 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.
   
   ### 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()
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to