gpt4 book ai didi

webclient - Spring WebClient reactor.netty.internal.shaded.reactor.pool.PoolAcquireTimeoutException

转载 作者:行者123 更新时间:2023-12-01 05:45:06 30 4
gpt4 key购买 nike

我正在使用 Spring WebClient 调用休息服务。如下所述的 post 调用代码。

Mono<ClientResponse> response = client.post()
.uri(uriBuilder -> uriBuilder.build())
.headers(httpHeaders -> httpHeaders.setAll(getHeaders()))
.body(BodyInserters.fromPublisher(Mono.just(message), String.class))
.exchange();
response.subscribe(clientResponse -> {
System.out.println(clientResponse.statusCode());
});

在连续发布一段时间后(在 5 分钟内发布 2-3 百万个请求后),我收到以下异常。
 [     parallel-3] r.c.s.Schedulers                         : Scheduler worker in group main failed with an uncaught exception

reactor.core.Exceptions$ErrorCallbackNotImplemented: reactor.netty.internal.shaded.reactor.pool.PoolAcquireTimeoutException: Pool#acquire(Duration) has been pending for more than the configured timeout of 45000ms
Caused by: reactor.netty.internal.shaded.reactor.pool.PoolAcquireTimeoutException: Pool#acquire(Duration) has been pending for more than the configured timeout of 45000ms
at reactor.netty.internal.shaded.reactor.pool.AbstractPool$Borrower.run(AbstractPool.java:317) ~[reactor-netty-0.9.0.RELEASE.jar!/:0.9.0.RELEASE]
Suppressed: reactor.core.publisher.FluxOnAssembly$OnAssemblyException:
Error has been observed at the following site(s):
|_ checkpoint ⇢ Request to POST https://myrest-service-c12-1-lb-125370128.us-west-2.elb.amazonaws.com/antenna [DefaultWebClient]
Stack trace:
at reactor.netty.internal.shaded.reactor.pool.AbstractPool$Borrower.run(AbstractPool.java:317) ~[reactor-netty-0.9.0.RELEASE.jar!/:0.9.0.RELEASE]
at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:68) [reactor-core-3.3.0.RELEASE.jar!/:3.3.0.RELEASE]
at reactor.core.scheduler.SchedulerTask.call(SchedulerTask.java:28) [reactor-core-3.3.0.RELEASE.jar!/:3.3.0.RELEASE]
at java.util.concurrent.FutureTask.run(FutureTask.java:264) [?:?]
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:304) [?:?]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) [?:?]
at java.lang.Thread.run(Thread.java:834) [?:?]

看起来池已经用完了,我需要限制请求的数量。有人可以帮助我解决这个问题。提前致谢。

最佳答案

似乎是 reactor-netty 中的一个 bug,最近已修复:https://github.com/reactor/reactor-netty/issues/1012

关于webclient - Spring WebClient reactor.netty.internal.shaded.reactor.pool.PoolAcquireTimeoutException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59419777/

30 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com