Spring Webflux – Web requests to different services using different webclients got stuck

My applications needs to get some data from one service (service A) and process it and trigger a POST request to another service (service B). All the requests to service A is properly handled, but application got stuck while trying to connect with service B after following log

DEBUG 1 — [ool-16-thread-1] r.n.r.PooledConnectionProvider : Creating a new [http] client pool [PoolFactory{evictionInterval=PT0S, leasingStrategy=fifo, maxConnections=500, maxIdleTime=-1, maxLifeTime=-1, metricsEnabled=false, pendingAcquireMaxCount=1000, pendingAcquireTimeout=45000}] for [service-B:8083]

I’ve separate Webclient instance with custom HTTP client configurations for each service.

All the requets from my application to service A is blocking call with block() statement (my application needs this). There’s no concurrent usage of the WebClient and the requests are processed one after another, then thread starvation should not be an issue.

To validate the connectivity and other configurations, removed all the REST calls to service A, then request from my application to service B is properly triggered. Following statements are logged

DEBUG 1 — [ool-16-thread-1] r.n.r.PooledConnectionProvider : Creating a new [http] client pool [PoolFactory{evictionInterval=PT0S, leasingStrategy=fifo, maxConnections=500, maxIdleTime=-1, maxLifeTime=-1, metricsEnabled=false, pendingAcquireMaxCount=1000, pendingAcquireTimeout=45000}] for [service-B:8083]

DEBUG 1 — [or-http-epoll-1] r.n.r.PooledConnectionProvider : [05f28394] Created a new pooled channel, now: 0 active connections, 0 inactive connections and 0 pending acquire requests.

Then I configured HttpClient for service B with custom event loop group as follows:

HttpClient httpClient =
HttpClient.create()
.runOn(new NioEventLoopGroup(1));

Now everything is working fine and requests are properly triggered to service B even after communicating with service A.

When dealing with two webclient, is it always needed to have custom event loop group? I suspect reactor-http-epoll threads are not made available for second webclient instance

Leave a Comment