Skip to content

Commit 92f2e3a

Browse files
authored
close the APM client response body regardless of the response (#1224)
1 parent 5b96b05 commit 92f2e3a

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

reporters/kamon-apm-reporter/src/main/scala/kamon/apm/ApiClient.scala

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ class ApiClient(settings: Settings) {
7373

7474
tryPosting match {
7575
case Success(response) =>
76+
// The response body must be closed (even if there is no body in the response),
77+
// otherwise OkHttp leaks connections.
78+
response.body().close()
79+
7680
response.code() match {
7781
case 200 =>
7882
_logger.trace("Request to the Kamon APM [{}] endpoint succeeded", endpointName)

0 commit comments

Comments
 (0)