【发布时间】:2018-11-27 11:48:41
【问题描述】:
什么可能导致这种情况发生?我的 Web 应用程序已冻结并停止响应。我去做了一个线程转储,发现 Thymeleaf 中有几个线程都被阻塞了:
Thread 3247: (state = BLOCKED)
- sun.misc.Unsafe.park(boolean, long) @bci=0 (Compiled frame; information may be imprecise)
- java.util.concurrent.locks.LockSupport.park(java.lang.Object) @bci=14, line=175 (Compiled frame)
- java.util.concurrent.locks.AbstractQueuedSynchronizer.parkAndCheckInterrupt() @bci=1, line=836 (Interpreted frame)
- java.util.concurrent.locks.AbstractQueuedSynchronizer.doAcquireSharedInterruptibly(int) @bci=72, line=997 (Interpreted frame)
- java.util.concurrent.locks.AbstractQueuedSynchronizer.acquireSharedInterruptibly(int) @bci=24, line=1304 (Compiled frame)
- java.util.concurrent.Semaphore.acquire() @bci=5, line=312 (Compiled frame)
- org.thymeleaf.util.ResourcePool.allocate() @bci=4, line=108 (Compiled frame)
- org.thymeleaf.templateparser.xmlsax.AbstractNonValidatingSAXTemplateParser.parseTemplateUsingPool(org.thymeleaf.Configuration, java.lang.String, java.io.Reader, org.thymeleaf.util.ResourcePool) @bci=2, line=124 (Compiled frame)
- org.thymeleaf.templateparser.xmlsax.AbstractNonValidatingSAXTemplateParser.parseTemplate(org.thymeleaf.Configuration, java.lang.String, java.io.Reader) @bci=8, line=116 (Compiled frame)
- org.thymeleaf.TemplateRepository.getTemplate(org.thymeleaf.TemplateProcessingParameters) @bci=556, line=278 (Compiled frame)
- org.thymeleaf.TemplateEngine.process(org.thymeleaf.TemplateProcessingParameters, org.thymeleaf.fragment.IFragmentSpec, java.io.Writer) @bci=11, line=1104 (Compiled frame)
- org.thymeleaf.TemplateEngine.process(java.lang.String, org.thymeleaf.context.IProcessingContext, org.thymeleaf.fragment.IFragmentSpec, java.io.Writer) @bci=110, line=1060 (Compiled frame)
- org.thymeleaf.TemplateEngine.process(java.lang.String, org.thymeleaf.context.IContext, org.thymeleaf.fragment.IFragmentSpec, java.io.Writer) @bci=17, line=1011 (Compiled frame)
- org.thymeleaf.spring4.view.ThymeleafView.renderFragment(org.thymeleaf.fragment.IFragmentSpec, java.util.Map, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) @bci=590, line=335 (Compiled frame)
- org.thymeleaf.spring4.view.ThymeleafView.render(java.util.Map, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse) @bci=5, line=190 (Compiled frame)
是什么原因造成的?表示层代码在应用程序的最后一个版本中没有改变。该应用程序相当成熟和稳定。我不确定从哪里开始调查。当我尝试通过负载测试重现问题时,应用程序现在重新部署回之前的版本。
为什么 Thymeleaf 需要任何类型的锁定?似乎 Thymeleaf 的一些基本架构方面在这里起作用,我不明白。
按照最严格的定义,这在技术上可能不是“死锁”,但结果是一样的。
【问题讨论】:
-
您使用的是哪个 thymeleaf 版本? 2.1.6.RELEASE?
-
我在 2.1.5.RELEASE