Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid nil dereferencing on errors #206

Merged
merged 1 commit into from Sep 23, 2022

Conversation

ankon
Copy link
Contributor

@ankon ankon commented Sep 23, 2022

What were you doing?

Requesting a certificate failed, and then additionally caused rate limiting issues as well.

Certmagic version: 0.17.1

This merges #204 to a similar place in config.go.


Stack we have seen:

  | 2022-09-23T10:46:17.120Z | {"level":"error","time":"2022-09-23T10:46:17Z","module":"cert.renew","caller":"certmagic/config.go:810","msg":"could not get certificate from issuer","identifier":"XXX","issuer":"acme-v02.api.letsencrypt.org-directory","error":"HTTP 429 urn:ietf:params:acme:error:rateLimited - Error creating new order :: too many failed authorizations recently: see https://letsencrypt.org/docs/failed-validation-limit/","stacktrace":"github.com/caddyserver/certmagic.(*Config).renewCert.func2\n\t/src/vendor/github.com/caddyserver/certmagic/config.go:810\ngithub.com/caddyserver/certmagic.doWithRetry\n\t/src/vendor/github.com/caddyserver/certmagic/async.go:106\ngithub.com/caddyserver/certmagic.(*Config).renewCert\n\t/src/vendor/github.com/caddyserver/certmagic/config.go:860\ngithub.com/caddyserver/certmagic.(*Config).RenewCertAsync\n\t/src/vendor/github.com/caddyserver/certmagic/config.go:690\ngithub.com/caddyserver/certmagic.(*Config).renewDynamicCertificate.func3\n\t/src/vendor/github.com/caddyserver/certmagic/handshake.go:664"}
  | 2022-09-23T10:46:17.120Z | {"level":"info","time":"2022-09-23T10:46:17Z","module":"cert.renew","caller":"certmagic/config.go:719","msg":"releasing lock","identifier":"XXX"}
  | 2022-09-23T10:46:17.127Z | panic: runtime error: invalid memory address or nil pointer dereference
  | 2022-09-23T10:46:17.127Z | [signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0xbc9db4]
  | 2022-09-23T10:46:17.127Z | goroutine 52862 [running]:
  | 2022-09-23T10:46:17.127Z | github.com/caddyserver/certmagic.(*Config).renewCert.func2({0x1450720, 0xc00c9e9590})
  | 2022-09-23T10:46:17.127Z | /src/vendor/github.com/caddyserver/certmagic/config.go:821 +0xc14
  | 2022-09-23T10:46:17.127Z | github.com/caddyserver/certmagic.doWithRetry({0x14506e8, 0xc000360360}, 0xc006f596c0, 0xc00776f720)
  | 2022-09-23T10:46:17.127Z | /src/vendor/github.com/caddyserver/certmagic/async.go:106 +0x1cb
  | 2022-09-23T10:46:17.128Z | github.com/caddyserver/certmagic.(*Config).renewCert(0xc00015b550, {0x14506e8, 0xc000360360}, {0xc003cbcfa0, 0xc}, 0x0, 0x0)
  | 2022-09-23T10:46:17.128Z | /src/vendor/github.com/caddyserver/certmagic/config.go:860 +0x58b
  | 2022-09-23T10:46:17.128Z | github.com/caddyserver/certmagic.(*Config).RenewCertAsync(...)
  | 2022-09-23T10:46:17.128Z | /src/vendor/github.com/caddyserver/certmagic/config.go:690
  | 2022-09-23T10:46:17.128Z | github.com/caddyserver/certmagic.(*Config).renewDynamicCertificate.func3({0x14506e8, 0xc000360360}, 0xc0001f7f20?)
  | 2022-09-23T10:46:17.128Z | /src/vendor/github.com/caddyserver/certmagic/handshake.go:664 +0x2ac
  | 2022-09-23T10:46:17.128Z | created by github.com/caddyserver/certmagic.(*Config).renewDynamicCertificate
  | 2022-09-23T10:46:17.128Z | /src/vendor/github.com/caddyserver/certmagic/handshake.go:699 +0x1293

config.go Outdated Show resolved Hide resolved
This merges caddyserver#204 to a similar place in config.go.
Copy link
Member

@mholt mholt left a comment

Choose a reason for hiding this comment

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

Thank you; not sure how I missed that.

@mholt mholt merged commit 55fc6a9 into caddyserver:master Sep 23, 2022
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.

None yet

2 participants