Open stepanv opened 4 years ago
@graemerocher, I'm willing to contribute this feature as long as it's something you'd (or someone else from the authors would) be willing to guide, review and merge.
PRs welcome!
A bit old thread here :) you mentioned when keep alive is enabled but based on the code you sent there is no keep-alive setting being configured. Am I missing something?
@BartUK it's possible it's Netty's behavior (or Micronaut) to automatically use keep-alive. Try to use Micronaut Client and in the log you'd see keep alive is there:
2021-09-02 CEST 16:39:26,525 [default-nioEventLoopGroup-1-4] [] [tid=] [sid=] [] [] DEBUG io.micronaut.http.client.netty.DefaultHttpClient - Sending HTTP POST to http://localhost:56122/monitoring/v1/foo
2021-09-02 CEST 16:39:26,528 [default-nioEventLoopGroup-1-4] [] [tid=] [sid=] [] [] TRACE io.micronaut.http.client.netty.DefaultHttpClient - Content-Type: text/plain
2021-09-02 CEST 16:39:26,528 [default-nioEventLoopGroup-1-4] [] [tid=] [sid=] [] [] TRACE io.micronaut.http.client.netty.DefaultHttpClient - Accept: application/json,application/x-json-stream
2021-09-02 CEST 16:39:26,528 [default-nioEventLoopGroup-1-4] [] [tid=] [sid=] [] [] TRACE io.micronaut.http.client.netty.DefaultHttpClient - host: localhost:56122
2021-09-02 CEST 16:39:26,528 [default-nioEventLoopGroup-1-4] [] [tid=] [sid=] [] [] TRACE io.micronaut.http.client.netty.DefaultHttpClient - connection: keep-alive
2021-09-02 CEST 16:39:26,529 [default-nioEventLoopGroup-1-4] [] [tid=] [sid=] [] [] TRACE io.micronaut.http.client.netty.DefaultHttpClient - content-length: 99
2021-09-02 CEST 16:39:26,529 [default-nioEventLoopGroup-1-4] [] [tid=] [sid=] [] [] TRACE io.micronaut.http.client.netty.DefaultHttpClient - Request Body
2021-09-02 CEST 16:39:26,529 [default-nioEventLoopGroup-1-4] [] [tid=] [sid=] [] [] TRACE io.micronaut.http.client.netty.DefaultHttpClient - ----
Based on my investigation, there is no way to instruct the Micronaut Client to
close
the connection (when keep alive is enabled) in case ofmicronaut.http.client.read-timeout
is reachedDisposable.dispose()
is called)My use cases are as follows:
Consider following 3 examples. All of them pass, but in all the cases, the client and the server must proceed with the computation because the connection is not closed.
Also enable http logging to see all the data are sent anyway (in
logback.xml
)