kubernetes-retired / go-open-service-broker-client

A golang client for service brokers implementing the Open Service Broker API
Apache License 2.0
61 stars 51 forks source link

Custom Transport used with HTTP Client has no timeouts & many bad defaults #132

Closed jboyd01 closed 5 years ago

jboyd01 commented 5 years ago

This is related to PR #131. Even after 131 was merged in Service Catalog I saw reports that the TCP Connections in ESTABLISHED state continued to climb and result in consuming too many resources. I reproduced and spent a day tracking this down. I finally realized why:

https://github.com/pmorie/go-open-service-broker-client/blob/9cc214e88d00504888af633376c9462e0ab2bd8b/v2/client.go#L41

This is creating a new Transport with bad defaults. In fact, many of them are horrible, ie zero for Timeout, KeepAlive, MaxIdleConnections.... & more

We should pick up the default values as specified in DefaultTransport and make modifications as necessary.

We could hardcode the source for the current defaults from https://github.com/golang/go/blob/b5ed6ec14092b04156adcbaba101958dc9d9d74b/src/net/http/transport.go#L42-L53 but that doesn't set us up well for picking up new versions or fixes. There is this suggestion: https://github.com/golang/go/issues/26013