Skip to content

Commit d16eee0

Browse files
committed
ARM client: survive empty response and error
We're seeing legacy-cloud-providersazure/clients (in our case, the synchronized copy used by cluster-autoscaler) segfaulting under heavy pressure and ARM throttling, like so: ``` panic: runtime error: invalid memory address or nil pointer dereference [signal SIGSEGV: segmentation violation code=0x1 addr=0x10 pc=0x1b595b5] cluster-autoscaler-all-79b9478bf5-cgkg8 cluster-autoscaler goroutine 82 [running]: k8s.io/autoscaler/cluster-autoscaler/vendor/k8s.io/legacy-cloud-providers/azure/clients/armclient.(*Client).Send(0xc00052f520, 0x3b6dc40, 0xc000937440, 0xc000933f00, 0x0, 0x0) /home/jb/go/src/k8s.io/autoscaler/cluster-autoscaler/vendor/k8s.io/legacy-cloud-providers/azure/clients/armclient/azure_armclient.go:122 +0xb5 ``` Reason is the ARM client expects `sendRequest()` to return either a non nil *retry.Error, or a non nil *http.Response, while both can be nil.
1 parent fd74333 commit d16eee0

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

staging/src/k8s.io/legacy-cloud-providers/azure/clients/armclient/azure_armclient.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,11 @@ func (c *Client) sendRequest(ctx context.Context, request *http.Request) (*http.
109109
request,
110110
retry.DoExponentialBackoffRetry(&sendBackoff),
111111
)
112+
113+
if response == nil && err == nil {
114+
return response, retry.NewError(false, fmt.Errorf("Empty response and no HTTP code"))
115+
}
116+
112117
return response, retry.GetError(response, err)
113118
}
114119

0 commit comments

Comments
 (0)