We got the following error using the WebClient in a Spring Boot 2.4.1 application. It appears to be missing some information and it's hard to tell what's going on. It only happened once in production and we haven't seen it in our tests.
message:
Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is org.springframework.web.reactive.function.client.WebClientRequestException: Error while acquiring from reactor.netty.internal.shaded.reactor.pool.SimpleDequePool@4e699e; nested exception is java.io.IOException: Error while acquiring from reactor.netty.internal.shaded.reactor.pool.SimpleDequePool@4e699e] with root cause
stacktrace:
java.io.IOException: Error while acquiring from reactor.netty.internal.shaded.reactor.pool.SimpleDequePool@4e699e
at reactor.netty.resources.DefaultPooledConnectionProvider$DisposableAcquire.run(DefaultPooledConnectionProvider.java:239)
at io.netty.util.concurrent.PromiseTask.runTask(PromiseTask.java:98)
at io.netty.util.concurrent.PromiseTask.run(PromiseTask.java:106)
at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:164)
at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:472)
at io.netty.channel.epoll.EpollEventLoop.run(EpollEventLoop.java:384)
at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:989)
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74)
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30)
at java.base/java.lang.Thread.run(Thread.java:832)
logger name: org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/].[dispatcherServlet]
thread name: http-nio-8085-exec-148
It seemed to come as a result of this code:
Mono<Object> mono = webClient.get()
.uri(uriBuilder -> {
uriBuilder.scheme(coreApiBaseUri.getScheme())
.host(coreApiBaseUri.getHost())
.port(coreApiBaseUri.getPort())
.pathSegment(versionPath, "projects", "{id}", "series");
return uriBuilder.build(projectId);
})
.headers(httpHeaders -> httpHeaders.addAll(incomingHeaders))
.exchangeToMono(clientResponse -> {
HttpStatus httpStatus = clientResponse.statusCode();
if (httpStatus.isError()) {
if (httpStatus != HttpStatus.BAD_REQUEST) {
log.warn("Received status {} from core-api while getting series", httpStatus);
}
return clientResponse.bodyToMono(ErrorDTO.class);
}
return clientResponse.bodyToMono(CoreApiSeriesDTO.class);
})
.timeout(Duration.ofMillis(1000))
.retryWhen(retryOnConnectionErrorsOr5xx("Retrying getting series for project {}, attempt {}", projectId));
Object dto = mono.block();
if (dto == null) {
throw new InternalException(String.format("No/invalid result for project id %s", projectId));
}
with helper code:
private Retry retryOnConnectionErrorsOr5xx(String logString, UUID logStringParam1) {
return Retry
.fixedDelay(3, Duration.ofSeconds(1L))
.filter(exception -> exception instanceof IOException
|| exception instanceof TimeoutException
|| exception instanceof WebClientResponseException
&& ((WebClientResponseException) exception).getStatusCode().is5xxServerError())
.doBeforeRetry(retrySignal -> {
log.info(logString, logStringParam1, retrySignal.totalRetries());
log.debug("Exception in retry: ", retrySignal.failure());
});
}
We got the following error using the WebClient in a Spring Boot 2.4.1 application. It appears to be missing some information and it's hard to tell what's going on. It only happened once in production and we haven't seen it in our tests.
message:
stacktrace:
logger name: org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/].[dispatcherServlet]
thread name: http-nio-8085-exec-148
It seemed to come as a result of this code:
with helper code: