-
Notifications
You must be signed in to change notification settings - Fork 42
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
Failure to apply a lot of changes in one pass #30
Comments
I tried a crude patch to limit MaxConnsPerHost, but it didn't fix it: diff --git a/pkg/artifactory/provider.go b/pkg/artifactory/provider.go
index cb41084..6f10fcd 100644
--- a/pkg/artifactory/provider.go
+++ b/pkg/artifactory/provider.go
@@ -62,16 +62,21 @@ func providerConfigure(d *schema.ResourceData) (interface{}, error) {
password := d.Get("password").(string)
token := d.Get("token").(string)
+ t := http.DefaultTransport.(*http.Transport)
+ t.MaxConnsPerHost = 1
+
var client *http.Client
if username != "" && password != "" {
tp := artifactory.BasicAuthTransport{
- Username: username,
- Password: password,
+ Username: username,
+ Password: password,
+ Transport: http.DefaultTransport,
}
client = tp.Client()
} else if token != "" {
tp := &artifactory.TokenAuthTransport{
- Token: token,
+ Token: token,
+ Transport: http.DefaultTransport,
}
client = tp.Client()
} else { |
Duplicate of #9. The suggested workaround is to set parallelism to 1. JFrog also provided an alternative solution, they recommended increasing this property to I have looked at client side throttling in the past, but I think the ideal solution would be retries with exponential backoff, this would have to be added to every resource. This is not a priority however since the issue is worked around easily. |
Look at https://www.jfrog.com/jira/browse/RTFACT-16638 |
Community Note
Affected Resource(s)
All during Create/Update/Delete operations
Terraform Configuration Files
pastebin link - 390 lines, 3 variables
Debug Output
Expected Behavior
I'd expect it to succeed like when it was smaller, or as it does after a couple of applies.
Actual Behavior
Artefactory can't keep up. It looks like there's a race to save the config which is worked around with server side retries, but that doesn't work when too many changes occur at once.
Steps to Reproduce
terraform apply
Important Factoids
I suspect it's possible to do something like set MaxConnsPerHost to 1 on the transport of the HTTP client, that way an instance of the terraform provider shouldn't be introducing the races that it otherwise would.
Work arounds include:
terraform apply --parallelism=1
which isn't super as other non-Artefactory providers will sufferterraform apply
until the state converges (can lead to bad state)There is a server side config option mentioned here that sets the number of retries, while not a solution, it should be a lead for reading up if needed.
The text was updated successfully, but these errors were encountered: