admin管理员组文章数量:1201412
Environment: 2vCpu, 8G RAM centos8, Jdk 21.0.5
a springboot3.4.1 project using undertow with virtual thread, only a simple restcontroller in the project. modify the log level of undertow and xnio to TRACE.(i found it's easy to reproduce the problem by modify the log level )
@RestController
public class MyController {
@ResponseBody()
@RequestMapping(value="/query",method={RequestMethod.GET,RequestMethod.POST})
public void query(
HttpServletRequest request,
HttpServletResponse response
) {
try {
Thread.sleep(60);
response.getWriter().write("Hello");
response.getWriter().flush();
} catch (Exception e) {
throw new RuntimeException(e.getMessage(), e);
}
}
}
application.properties
spring.application.name=deadlock
spring.threads.virtual.enabled=true
server.port=2280
server.servlet.context-path=/
logback.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE configuration>
<configuration>
<appender name="stdout" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>%date [%thread] %-5level %logger{15} - %msg%n</pattern>
<charset>UTF-8</charset>
</encoder>
<layout class="ch.qos.logback.classic.PatternLayout">
<pattern>%date [%thread] %-5level %logger{80} - %msg%n</pattern>
</layout>
</appender>
<logger name="org.xnio" additivity="false" level="TRACE">
<appender-ref ref="stdout" />
</logger>
<logger name="io.undertow" additivity="false" level="TRACE">
<appender-ref ref="stdout" />
</logger>
<root>
<level value="WARN" />
<appender-ref ref="stdout" />
</root>
</configuration>
after the project run, using ab to test the project.
ab -r -q -n 100000 -c 1000 "http://127.0.0.1:2280/query"
the xnio accept thread will stop working. ab test report a timeout failure
Full thread dump Java HotSpot(TM) 64-Bit Server VM (21.0.5+9-LTS-239 mixed mode, sharing):
Threads class SMR info:
_java_thread_list=0x00007f7618006340, length=18, elements={
0x00007f76a013b140, 0x00007f76a013c7c0, 0x00007f76a013df40, 0x00007f76a013f570,
0x00007f76a0140b00, 0x00007f76a0142630, 0x00007f76a0143ce0, 0x00007f76a0157b30,
0x00007f76a015ab70, 0x00007f76a01ea330, 0x00007f76a0f7cab0, 0x00007f76a0f7d5e0,
0x00007f76a0f7e150, 0x00007f76a0028ab0, 0x00007f7620011870, 0x00007f76280052d0,
0x00007f76280be780, 0x00007f7618006d60
}
"Reference Handler" #9 [3004538] daemon prio=10 os_prio=0 cpu=2.55ms elapsed=1409.79s tid=0x00007f76a013b140 nid=3004538 waiting on condition [0x00007f76a481e000]
java.lang.Thread.State: RUNNABLE
at java.lang.ref.Reference.waitForReferencePendingList([email protected]/Native Method)
at java.lang.ref.Reference.processPendingReferences([email protected]/Reference.java:246)
at java.lang.ref.Reference$ReferenceHandler.run([email protected]/Reference.java:208)
Locked ownable synchronizers:
- None
"Finalizer" #10 [3004539] daemon prio=8 os_prio=0 cpu=0.15ms elapsed=1409.79s tid=0x00007f76a013c7c0 nid=3004539 in Object.wait() [0x00007f76a471d000]
java.lang.Thread.State: WAITING (on object monitor)
at java.lang.Object.wait0([email protected]/Native Method)
- waiting on <0x000000008a2be4b8> (a java.lang.ref.NativeReferenceQueue$Lock)
at java.lang.Object.wait([email protected]/Object.java:366)
at java.lang.Object.wait([email protected]/Object.java:339)
at java.lang.ref.NativeReferenceQueue.await([email protected]/NativeReferenceQueue.java:48)
at java.lang.ref.ReferenceQueue.remove0([email protected]/ReferenceQueue.java:158)
at java.lang.ref.NativeReferenceQueue.remove([email protected]/NativeReferenceQueue.java:89)
- locked <0x000000008a2be4b8> (a java.lang.ref.NativeReferenceQueue$Lock)
at java.lang.ref.Finalizer$FinalizerThread.run([email protected]/Finalizer.java:173)
Locked ownable synchronizers:
- None
"Signal Dispatcher" #11 [3004540] daemon prio=9 os_prio=0 cpu=0.25ms elapsed=1409.79s tid=0x00007f76a013df40 nid=3004540 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
Locked ownable synchronizers:
- None
"Service Thread" #12 [3004541] daemon prio=9 os_prio=0 cpu=1.16ms elapsed=1409.79s tid=0x00007f76a013f570 nid=3004541 runnable [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
Locked ownable synchronizers:
- None
"Monitor Deflation Thread" #13 [3004542] daemon prio=9 os_prio=0 cpu=63.04ms elapsed=1409.79s tid=0x00007f76a0140b00 nid=3004542 runnable [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
Locked ownable synchronizers:
- None
"C2 CompilerThread0" #14 [3004543] daemon prio=9 os_prio=0 cpu=2490.39ms elapsed=1409.79s tid=0x00007f76a0142630 nid=3004543 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
No compile task
Locked ownable synchronizers:
- None
"C1 CompilerThread0" #15 [3004544] daemon prio=9 os_prio=0 cpu=758.15ms elapsed=1409.79s tid=0x00007f76a0143ce0 nid=3004544 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
No compile task
Locked ownable synchronizers:
- None
"Notification Thread" #16 [3004545] daemon prio=9 os_prio=0 cpu=0.04ms elapsed=1409.78s tid=0x00007f76a0157b30 nid=3004545 runnable [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
Locked ownable synchronizers:
- None
"Common-Cleaner" #17 [3004546] daemon prio=8 os_prio=0 cpu=2.56ms elapsed=1409.78s tid=0x00007f76a015ab70 nid=3004546 waiting on condition [0x00007f7684c9a000]
java.lang.Thread.State: TIMED_WAITING (parking)
at jdk.internal.misc.Unsafe.park([email protected]/Native Method)
- parking to wait for <0x000000008a232ed0> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.parkNanos([email protected]/LockSupport.java:269)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await([email protected]/AbstractQueuedSynchronizer.java:1852)
at java.lang.ref.ReferenceQueue.await([email protected]/ReferenceQueue.java:71)
at java.lang.ref.ReferenceQueue.remove0([email protected]/ReferenceQueue.java:143)
at java.lang.ref.ReferenceQueue.remove([email protected]/ReferenceQueue.java:218)
at jdk.internal.ref.CleanerImpl.run([email protected]/CleanerImpl.java:140)
at java.lang.Thread.runWith([email protected]/Thread.java:1596)
at java.lang.Thread.run([email protected]/Thread.java:1583)
at jdk.internal.misc.InnocuousThread.run([email protected]/InnocuousThread.java:186)
Locked ownable synchronizers:
- None
"Cleaner-0" #18 [3004547] daemon prio=8 os_prio=0 cpu=4.15ms elapsed=1409.73s tid=0x00007f76a01ea330 nid=3004547 waiting on condition [0x00007f7684b99000]
java.lang.Thread.State: TIMED_WAITING (parking)
at jdk.internal.misc.Unsafe.park([email protected]/Native Method)
- parking to wait for <0x000000008a233c00> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.parkNanos([email protected]/LockSupport.java:269)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await([email protected]/AbstractQueuedSynchronizer.java:1852)
at java.lang.ref.ReferenceQueue.await([email protected]/ReferenceQueue.java:71)
at java.lang.ref.ReferenceQueue.remove0([email protected]/ReferenceQueue.java:143)
at java.lang.ref.ReferenceQueue.remove([email protected]/ReferenceQueue.java:218)
at jdk.internal.ref.CleanerImpl.run([email protected]/CleanerImpl.java:140)
at java.lang.Thread.runWith([email protected]/Thread.java:1596)
at java.lang.Thread.run([email protected]/Thread.java:1583)
at jdk.internal.misc.InnocuousThread.run([email protected]/InnocuousThread.java:186)
Locked ownable synchronizers:
- None
"XNIO-1 I/O-1" #25 [3004553] prio=5 os_prio=0 cpu=39.81ms elapsed=1407.16s tid=0x00007f76a0f7cab0 nid=3004553 waiting for monitor entry [0x00007f7684875000]
java.lang.Thread.State: BLOCKED (on object monitor)
at org.xnio.nio.WorkerThread.execute(WorkerThread.java:635)
- waiting to lock <0x000000009175c298> (a java.lang.Object)
at org.xnio.nio.QueuedNioTcpServer2.acceptTask(QueuedNioTcpServer2.java:180)
at org.xnio.nio.QueuedNioTcpServer2$$Lambda/0x00007f76304104a0.run(Unknown Source)
at org.xnio.nio.WorkerThread.safeRun(WorkerThread.java:624)
at org.xnio.nio.WorkerThread.run(WorkerThread.java:491)
Locked ownable synchronizers:
- None
"XNIO-1 I/O-2" #26 [3004554] prio=5 os_prio=0 cpu=65.43ms elapsed=1407.16s tid=0x00007f76a0f7d5e0 nid=3004554 runnable [0x00007f7684976000]
java.lang.Thread.State: RUNNABLE
at sun.nio.ch.EPoll.wait([email protected]/Native Method)
at sun.nio.ch.EPollSelectorImpl.doSelect([email protected]/EPollSelectorImpl.java:121)
at sun.nio.ch.SelectorImpl.lockAndDoSelect([email protected]/SelectorImpl.java:130)
- locked <0x000000009175c4c0> (a sun.nio.ch.Util$2)
- locked <0x000000009175c358> (a sun.nio.ch.EPollSelectorImpl)
at sun.nio.ch.SelectorImpl.select([email protected]/SelectorImpl.java:147)
at org.xnio.nio.WorkerThread.run(WorkerThread.java:544)
Locked ownable synchronizers:
- None
"XNIO-1 Accept" #27 [3004555] prio=5 os_prio=0 cpu=29.20ms elapsed=1407.16s tid=0x00007f76a0f7e150 nid=3004555 waiting on condition [0x00007f7684773000]
java.lang.Thread.State: WAITING (parking)
at jdk.internal.misc.Unsafe.park([email protected]/Native Method)
- parking to wait for <0x00000000ffd02018> (a java.util.concurrent.locks.ReentrantLock$NonfairSync)
at java.util.concurrent.locks.LockSupport.park([email protected]/LockSupport.java:221)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire([email protected]/AbstractQueuedSynchronizer.java:754)
at java.util.concurrent.locks.AbstractQueuedSynchronizer.acquire([email protected]/AbstractQueuedSynchronizer.java:990)
at java.util.concurrent.locks.ReentrantLock$Sync.lock([email protected]/ReentrantLock.java:153)
at java.util.concurrent.locks.ReentrantLock.lock([email protected]/ReentrantLock.java:322)
at ch.qos.logback.core.OutputStreamAppender.writeBytes(OutputStreamAppender.java:211)
at ch.qos.logback.core.OutputStreamAppender.writeOut(OutputStreamAppender.java:204)
at ch.qos.logback.core.OutputStreamAppender.subAppend(OutputStreamAppender.java:257)
at ch.qos.logback.core.OutputStreamAppender.append(OutputStreamAppender.java:111)
at ch.qos.logback.core.UnsynchronizedAppenderBase.doAppend(UnsynchronizedAppenderBase.java:85)
at ch.qos.logback.core.spi.AppenderAttachableImpl.appendLoopOnAppenders(AppenderAttachableImpl.java:51)
at ch.qos.logback.classic.Logger.appendLoopOnAppenders(Logger.java:272)
at ch.qos.logback.classic.Logger.callAppenders(Logger.java:259)
at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:426)
at ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Logger.java:386)
at ch.qos.logback.classic.Logger.log(Logger.java:780)
at java.lang.invoke.LambdaForm$DMH/0x00007f7630328000.invokeInterface([email protected]/LambdaForm$DMH)
at java.lang.invoke.LambdaForm$MH/0x00007f763043d000.invoke([email protected]/LambdaForm$MH)
at java.lang.invoke.Invokers$Holder.invokeExact_MT([email protected]/Invokers$Holder)
at jdk.internal.reflect.DirectMethodHandleAccessor.invokeImpl([email protected]/DirectMethodHandleAccessor.java:157)
at jdk.internal.reflect.DirectMethodHandleAccessor.invoke([email protected]/DirectMethodHandleAccessor.java:103)
at java.lang.reflect.Method.invoke([email protected]/Method.java:580)
at org.jboss.logging.Slf4jLocationAwareLogger.doLog(Slf4jLocationAwareLogger.java:100)
at org.jboss.logging.Slf4jLocationAwareLogger.doLogf(Slf4jLocationAwareLogger.java:93)
at org.jboss.logging.Logger.logf(Logger.java:2400)
at org.jboss.logging.DelegatingBasicLogger.tracef(DelegatingBasicLogger.java:123)
at org.xnio.nio.WorkerThread.execute(WorkerThread.java:636)
- locked <0x000000009175c298> (a java.lang.Object)
at org.xnio.nio.QueuedNioTcpServer2.handleReady(QueuedNioTcpServer2.java:160)
at org.xnio.nio.QueuedNioTcpServer2.lambda$new$1(QueuedNioTcpServer2.java:58)
at org.xnio.nio.QueuedNioTcpServer2$$Lambda/0x00007f7630410af0.handleEvent(Unknown Source)
at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:92)
at org.xnio.nio.NioTcpServerHandle.handleReady(NioTcpServerHandle.java:65)
at org.xnio.nio.WorkerThread.run(WorkerThread.java:603)
Locked ownable synchronizers:
- None
"DestroyJavaVM" #28 [3004530] prio=5 os_prio=0 cpu=2110.79ms elapsed=1407.10s tid=0x00007f76a0028ab0 nid=3004530 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
Locked ownable synchronizers:
- None
"ForkJoinPool-1-worker-1" #30 [3004597] daemon prio=5 os_prio=0 cpu=91.01ms elapsed=1375.37s tid=0x00007f7620011870 [0x00007f7684662000]
Carrying virtual thread #56
at jdk.internal.vm.Continuation.run([email protected]/Continuation.java:251)
at java.lang.VirtualThread.runContinuation([email protected]/VirtualThread.java:245)
at java.lang.VirtualThread$$Lambda/0x00007f763044cf70.run([email protected]/Unknown Source)
at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec([email protected]/ForkJoinTask.java:1423)
at java.util.concurrent.ForkJoinTask.doExec([email protected]/ForkJoinTask.java:387)
at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec([email protected]/ForkJoinPool.java:1312)
at java.util.concurrent.ForkJoinPool.scan([email protected]/ForkJoinPool.java:1843)
at java.util.concurrent.ForkJoinPool.runWorker([email protected]/ForkJoinPool.java:1808)
at java.util.concurrent.ForkJoinWorkerThread.run([email protected]/ForkJoinWorkerThread.java:188)
Locked ownable synchronizers:
- None
"ForkJoinPool-1-worker-2" #31 [3004598] daemon prio=5 os_prio=0 cpu=41.78ms elapsed=1375.36s tid=0x00007f76280052d0 [0x00007f7684561000]
Carrying virtual thread #55
at jdk.internal.vm.Continuation.run([email protected]/Continuation.java:251)
at java.lang.VirtualThread.runContinuation([email protected]/VirtualThread.java:245)
at java.lang.VirtualThread$$Lambda/0x00007f763044cf70.run([email protected]/Unknown Source)
at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec([email protected]/ForkJoinTask.java:1423)
at java.util.concurrent.ForkJoinTask.doExec([email protected]/ForkJoinTask.java:387)
at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec([email protected]/ForkJoinPool.java:1312)
at java.util.concurrent.ForkJoinPool.scan([email protected]/ForkJoinPool.java:1843)
at java.util.concurrent.ForkJoinPool.runWorker([email protected]/ForkJoinPool.java:1808)
at java.util.concurrent.ForkJoinWorkerThread.run([email protected]/ForkJoinWorkerThread.java:188)
Locked ownable synchronizers:
- None
"VirtualThread-unparker" #32 [3004599] daemon prio=5 os_prio=0 cpu=3.00ms elapsed=1375.32s tid=0x00007f76280be780 nid=3004599 waiting on condition [0x00007f7684461000]
java.lang.Thread.State: WAITING (parking)
at jdk.internal.misc.Unsafe.park([email protected]/Native Method)
- parking to wait for <0x000000008f7e7bd8> (a java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
at java.util.concurrent.locks.LockSupport.park([email protected]/LockSupport.java:371)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionNode.block([email protected]/AbstractQueuedSynchronizer.java:519)
at java.util.concurrent.ForkJoinPool.unmanagedBlock([email protected]/ForkJoinPool.java:3780)
at java.util.concurrent.ForkJoinPool.managedBlock([email protected]/ForkJoinPool.java:3725)
at java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.await([email protected]/AbstractQueuedSynchronizer.java:1712)
at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take([email protected]/ScheduledThreadPoolExecutor.java:1170)
at java.util.concurrent.ScheduledThreadPoolExecutor$DelayedWorkQueue.take([email protected]/ScheduledThreadPoolExecutor.java:899)
at java.util.concurrent.ThreadPoolExecutor.getTask([email protected]/ThreadPoolExecutor.java:1070)
at java.util.concurrent.ThreadPoolExecutor.runWorker([email protected]/ThreadPoolExecutor.java:1130)
at java.util.concurrent.ThreadPoolExecutor$Worker.run([email protected]/ThreadPoolExecutor.java:642)
at java.lang.Thread.runWith([email protected]/Thread.java:1596)
at java.lang.Thread.run([email protected]/Thread.java:1583)
at jdk.internal.misc.InnocuousThread.run([email protected]/InnocuousThread.java:186)
Locked ownable synchronizers:
- None
"Attach Listener" #211 [3005908] daemon prio=9 os_prio=0 cpu=0.32ms elapsed=59.57s tid=0x00007f7618006d60 nid=3005908 waiting on condition [0x0000000000000000]
java.lang.Thread.State: RUNNABLE
Locked ownable synchronizers:
- None
"VM Thread" os_prio=0 cpu=32.12ms elapsed=1409.79s tid=0x00007f76a012e090 nid=3004537 runnable
"GC Thread#0" os_prio=0 cpu=34.80ms elapsed=1409.81s tid=0x00007f76a007bba0 nid=3004531 runnable
"GC Thread#1" os_prio=0 cpu=40.01ms elapsed=1409.64s tid=0x00007f761c005f40 nid=3004548 runnable
"G1 Main Marker" os_prio=0 cpu=0.16ms elapsed=1409.81s tid=0x00007f76a008bd20 nid=3004532 runnable
"G1 Conc#0" os_prio=0 cpu=8.24ms elapsed=1409.81s tid=0x00007f76a008ccc0 nid=3004533 runnable
"G1 Refine#0" os_prio=0 cpu=540.74ms elapsed=1409.81s tid=0x00007f76a0100d10 nid=3004534 runnable
"G1 Service" os_prio=0 cpu=20.52ms elapsed=1409.80s tid=0x00007f76a0101cc0 nid=3004535 runnable
"VM Periodic Task Thread" os_prio=0 cpu=312.34ms elapsed=1409.80s tid=0x00007f76a011c7f0 nid=3004536 waiting on condition
JNI global refs: 12, weak refs: 0
i can't find any deadlock in jstack output. the tcp accept queue is full
本文标签: Undertow stopped response when using virtual thread in Springboot341Stack Overflow
版权声明:本文标题:Undertow stopped response when using virtual thread in Springboot3.4.1 - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1738613394a2102762.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论