140 questions
2
votes
2
answers
213
views
MDC and SecurityContext propagation failing when using Virtual Threads (Executor)
I am migrating a Spring Boot 3.x application to use Java Virtual Threads. I have replaced my standard async executor with a virtual thread executor:
@Bean
public Executor taskExecutor() {
return ...
3
votes
2
answers
455
views
"Deadlock" caused by virtual threads in JDK21
public class Test {
private static final Object lock = new Object();
public static void main(String[] args) {
try (var executor = Executors.newVirtualThreadPerTaskExecutor()) {
...
1
vote
0
answers
134
views
jdk24 tomcat start pinned in virtual thead env
env
jdk:openjdk24
tomcat:10.1.40
virtual thread enabled:true
problem: the carrier thread pinned
jstack as below
detail jstack info
detail jcmd vt info
"ForkJoinPool-1-worker-1" #50 [...
3
votes
1
answer
492
views
ExecutorService configuration with virtual threads
In a service I have 2 executorServices for different tasks:
get user transactions (50-100 threads, queue 300)
get user family (10-50 threads, queue 100)
It was easy to monitoring threads and adding ...
1
vote
3
answers
515
views
Virtual threads vs reactive database drivers
There is a typical task: consume data from Kafka (or REST/gRPC), process it, and persist it in the DB.
The database has always been our weak point. We usually have hundreds or thousands of messages to ...
2
votes
0
answers
242
views
Do virtual threads cause heap allocations and GC pressure when their stack grows?
I'm working with Java's virtual threads and trying to fully understand their memory management implications, specifically regarding their stacks.
My current understanding is that a virtual thread's ...
4
votes
1
answer
577
views
How can I schedule and monitor virtual threads with timeouts in Spring Boot?
I'm writing an application that requires me to dynamically spawn tasks based on user input. There can be hundreds of such tasks, and they will have different combinations of individual task timeouts, ...
0
votes
1
answer
247
views
JDK21 Virtual Thread: Thread.sleep() causes subsequent LockSupport.parkNanos() to not block [closed]
Environment: Java 21+ (Virtual Threads)
Problem Description
When using virtual threads, calling Thread.sleep() before LockSupport.parkNanos() causes subsequent parking operations to return immediately ...
4
votes
2
answers
589
views
Asynchronous processing using virtual threads and @Async annotation
I have a spring boot project version 3.5 with virtual threads (spring.virtual.threads.enabled=true) and @EnableAsyncConfig enabled.
I have a simple RestController which is calling the service layer ...
0
votes
1
answer
179
views
What can prevent connection to return to connection pool and make it stay after transaction is done?
I ran into an interesting problem during performance testing of an application running on the spring boot. Basically the method in question looks like this:
public void method(Request request) {
...
2
votes
1
answer
458
views
How to execute Quartz jobs in virtual threads
How can I leverage virtual threads to execute I/O-bound Quartz jobs within a Quarkus microservice, handling programmatic job triggering without cron-based scheduling?
We are considering Quartz for our ...
2
votes
1
answer
712
views
Spring Boot virtual threads on dedicated tomcat
We use our Spring Boot applications on dedicated tomcat servers, aka WAR deployment.
I want to give virtual threads a try.
So for my understanding, using Java 21, tomcat11 and the latest Spring Boot (...
2
votes
0
answers
145
views
Why does WebClient in WebFlux switch from virtual thread to platform thread after async boundary?
I'm exploring the use of virtual threads (Java 21) in a Spring WebFlux application by using a custom Scheduler backed by a virtual thread executor via .subscribeOn().
However, I’ve noticed that while ...
1
vote
1
answer
454
views
Virtual Threads in Spring Integration for long-running external service calls
We are currently working on a Spring Integration flow where each incoming message needs to trigger a call to an external HTTP service. The external call can take up to 20 seconds to complete, and the ...
8
votes
2
answers
843
views
Using ScopedValue instead of ThreadLocal in Servlet Filter in spring boot app
Our application heavily uses ThreadLocals where we read values from ServletRequest parameters and provide theses as a global context on Thread Level to other Services.
Something like this:
@Component
@...