-
Notifications
You must be signed in to change notification settings - Fork 17.9k
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
x/crypto/acme: Client.FetchCert hangs even with timeout context #38790
Comments
Looks like a combination of a deadlock and an infinite loop. FetchCert causes the following execution chain This happens because both |
Change https://golang.org/cl/233164 mentions this issue: |
When methods that use POSTs are called on a acme.Client which has a nil Key field it will cause a deadlock due to an infinite loop in the code that looks up the account KID. This change adds a check for the key being nil, and errors out if that is the case. Also adds a test for this behavior. Fixes golang/go#38790 Change-Id: I65ff6bbbade7ed2d85306895904a976089730bbf Reviewed-on: https://go-review.googlesource.com/c/crypto/+/233164 Trust: Roland Shoemaker <roland@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
When methods that use POSTs are called on a acme.Client which has a nil Key field it will cause a deadlock due to an infinite loop in the code that looks up the account KID. This change adds a check for the key being nil, and errors out if that is the case. Also adds a test for this behavior. Fixes golang/go#38790 Change-Id: I65ff6bbbade7ed2d85306895904a976089730bbf Reviewed-on: https://go-review.googlesource.com/c/crypto/+/233164 Trust: Roland Shoemaker <roland@golang.org> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
What version of Go are you using (
go version
)?Does this issue reproduce with the latest release?
Unknown as I'm unable to run go 1.14 right this moment. This shouldn't have anything to do with Go itself though, it's about the acme library.
What operating system and processor architecture are you using (
go env
)?go env
OutputWhat did you do?
What did you expect to see?
Program to exit at some point, preferably with an error due to the garbage url given.
What did you see instead?
Program never exits.
Additional Information
It seems that the acme code is buggy around its use of the cacheMu mutex. https://github.com/golang/crypto/blob/master/acme/acme.go#L143 will grab the lock, but can call getRegRFC which can then call post, etc. until it tries to grab the lock again, and deadlocks.
The text was updated successfully, but these errors were encountered: