Go-Splunk-HTTP icon indicating copy to clipboard operation
Go-Splunk-HTTP copied to clipboard

http connection not closing properly

Open chrisdziegielewski opened this issue 6 years ago • 0 comments

If you are moving a high volume of messages to splunk, the doRequest (splunk/splunk.go) function is not properly closing the http request and you quickly run out of file descriptors. The code below should be added before each of the returns on lines 164 and 173. It's better not to use the "defer" as this also waits longer than necessary to close the connection.

if res != nil {
	res.Body.Close()
}

chrisdziegielewski avatar Jul 18 '19 20:07 chrisdziegielewski