Running on: openjdk 22.0.2
, Kotlin: 2.0.21
, Spring Boot: 3.3.5
, Spring Cloud: 2023.0.3
.
My Project is a REST API using Hikari for connection pooling. When I run many concurrent requests against my app, I can see that some connections never return to HikariPool
HikariPool-1 - Pool stats (total=10, active=3, idle=7, waiting=0)
I got a thread dump and can see many threads are in TIMED_WAITING
state.
http-nio-7900-exec-18 (waiting on condition)
http-nio-7900-exec-18" prio=0 tid=0x0 nid=0x0 waiting on condition
java.lang.Thread.State: TIMED_WAITING
on kotlinx.coroutines.BlockingCoroutine@70dc10b
at java.base@22.0.2/jdk.internal.misc.Unsafe.park(Native Method)
All the waiting on condition
threads are running Kotlin runBloking
code in which I'm using org.springframework.web.reactive.function.client.WebClient
.
As an example,
<code-removed-for-brevity>
val result: Map<String, Any> = runBlocking {
getFileDetails("user1", fileId)
}
private fun createWebClient(username: String, logging: Boolean = true): WebClient {
return WebClient.builder()
.uriBuilderFactory(factory)
.clientConnector(if (logging) loggingConnector else nonLoggingConnector)
.filters { exchangeFilterFunctions -> filters.forEach { exchangeFilterFunctions.add(it) } }
.codecs { it.defaultCodecs().maxInMemorySize(MAX_MEMORY_SIZE) }
.build()
}
private suspend fun getFileDetails(
username: String,
fileId: Long,
): Map<String, Any> {
return createWebClient(username)
.get()
.uri { uriBuilder ->
uriBuilder
.path("/files/$fileId")
.build()
}
.retrieve()
.awaitBody()
}
Note that:
- Spring Boot
3.3.5
brings inspring-webflux
version6.1.14
. - Same code works in Spring Boot
3.3.4
which brings inspring-webflux
version6.1.13
. - I use Spring mvc in controller and not reactive controller.
If I override spring-webflux
in my pom back to 6.1.13
everything works just fine. There are no threads in TIMED_WAITING
and HiKari pool will show active connection of 0
at the end of my concurrent test.
Is this a bug related to spring-webflux
version 6.1.14
?
Comment From: sdeleuze
Hey, sorry for the delay, if you still observe this issue with Spring Framework 6.2, could you please provide a reproducer that can allow us to reproduce the working version and the broken one?
Comment From: spring-projects-issues
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Comment From: spring-projects-issues
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.