-
Notifications
You must be signed in to change notification settings - Fork 106
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix #333 Close HTTP connections #334
Fix #333 Close HTTP connections #334
Conversation
val client = createHttpClient() | ||
val response = client(request) | ||
|
||
return ResponseWrapper(response, request.uri.toString()) | ||
return ResponseWrapper(response, request.uri.toString()).use(mapper) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Won't it fix the issue if we just close the response here? I mean
val client = createHttpClient()
val response = client(request)
response.close()
return ResponseWrapper(response, request.uri.toString())
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The connection will be closed of course, but I'm afraid that if you try to access the request's body after that, you'll get an exception
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually, it seems that closing the response doesn't help at this point. The returned response object is a MemoryResponse, so closing it is a no-op. The HTTP connection is probably expected to be closed in CloseableHttpResponse.toHttp4kResponse
which consumes the entire payload, but again, that doesn't happen in our AWS setup.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@strangepleasures have you checked that the edits you have introduced fix the issue in your AWS setup?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can provide you with pip package if you need
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ApacheClient()
without arguments creates a client with a PoolingHttpClientConnectionManager
with infinite TTL. Maybe, that's why connections never get closed.
970b399
to
80e9103
Compare
No description provided.