mirror of
https://github.com/open-policy-agent/opa.git
synced 2026-08-16 13:22:53 -06:00
c77f9ed228
When instantiating a http.Transport struct without providing non-zero values for some of its fields, it will leak connections. The docs hint at this (https://golang.org/pkg/net/http/#Transport): By default, Transport caches connections for future re-use. This may leave many open connections when accessing many hosts. This behavior can be managed using Transport's CloseIdleConnections method and the MaxIdleConnsPerHost and DisableKeepAlives fields. See this issue for details: https://github.com/golang/go/issues/19620 I have not observed any leaks in the wild for this, but I'm also not using this plugin. I came to fix this because I had recently introduced a bug in the server tests -- they were altering the settings for the global http.DefaultTransport when my intention was to create a copy. Digging in while fixing that revealed this other location. (The fix for the server tests is in the next commit). Signed-off-by: Stephan Renatus <srenatus@chef.io>