We developed our team's new service with spring-webflux. It has been working well. Only one thing we could not figure out is below log
Error [reactor.netty.ReactorNetty$InternalNettyException: io.netty.channel.ExtendedClosedChannelException] for HTTP GET "[TARGET_URL]", but ServerHttpResponse already committed (200 OK)
Although it does not frequently happen, it is logged in our datadog log.
The service is a kind of middle man. One service sends "get" request to it, and then it calls other backends to gather data, then return. In the service layer, we use Mono.zip to combine all response from various backends. Both clients and backends are traditional thread base sprint applications.
Our code to build webclient is:
TcpClient timeoutClient = TcpClient.create()
.option(ChannelOption.CONNECT_TIMEOUT_MILLIS, connectionTimeout)
.doOnConnected(
// There are various handlers like WriteTimeoutHandler. We can add more when we need them.
c -> c.addHandlerLast(new ReadTimeoutHandler(readTimeout, TimeUnit.MILLISECONDS)));
final ReactorClientHttpConnector connector = new ReactorClientHttpConnector(HttpClient.from(timeoutClient));
return WebClient.builder()
.clientConnector(connector)
.baseUrl(property.getBaseUrl());
connection timeout is set to 2500 milliseconds. read timeout is 50-90ms depends on backends.
Thanks!