-
-
Notifications
You must be signed in to change notification settings - Fork 293
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
Decouple cleanup context from obtaining context #313
Comments
Ah, yeah, that's tricky. Cleanup probably needs to be given a separate, uncanceled context, but we have to really trust that it won't take long to run. Maybe we could pass in a context with a new cancel (like a new timeout, but long enough). |
My idea was to allow passing a custom context to If no custom context is provided, it will just fall back to the current behaviour. This would be pulled through to certmagic as well, where a custom context can be passed to the Lines 43 to 157 in 65cf36c
Then, when creating the Lines 258 to 282 in 65cf36c
I think then it is just about documenting this feature so users understand the consequence, and that one has to cancel this context on e.g. application shutdown. If you don't want to have the API changed, however, I think a new context with a sane (possibly configurable) timeout is good as well. |
What version of the package are you using?
v0.21.4
What are you trying to do?
Cleaning up after a failed obtain attempt
What steps did you take?
Configured Certmagic to issue certificates on-demand
What did you expect to happen, and what actually happened instead?
Obtaining an on-demand certificate runs into the configured timeout of 180s:
certmagic/handshake.go
Lines 524 to 526 in c783cbd
If that happens, I expect the cleanup routines to succeed.
https://github.com/mholt/acmez/blob/527e47cae3f84fa3a92d1d9b9c21c5eb0b44359a/client.go#L316-L323
https://github.com/mholt/acmez/blob/527e47cae3f84fa3a92d1d9b9c21c5eb0b44359a/client.go#L337
However, the cleanup routines are bound to the cancelled context, and won't run as the context was cancelled.
Show error logs
How do you think this should be fixed?
Allow to provide a long-running context for cleanup routines, which is passed to acmez, if this makes sense.
Bonus: What do you use CertMagic for, and do you find it useful?
Creating on-demand certificates for parked domains
The text was updated successfully, but these errors were encountered: